Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

activex scroll bars

Status
Not open for further replies.

esdee

Programmer
Apr 12, 2001
143
US
hi,
i wrote an activex control in vc++, but now i want to add scroll bars to it. how can i do this? or may be i should implement the scrollbars in the container? it will be a VB form and i dont have much experience with VB
 
for those who want to know -
<code>
in OnCreate():

CRect rect;
::GetClientRect:):GetParent(lpCreateStruct->hwndParent),&rect);

m_VScrollBar.Create(
SBS_VERT | SBS_RIGHTALIGN | WS_CHILD| WS_VISIBLE,
CRect(rect.left-15, 0, rect.right,rect.bottom), this, 1999);


SCROLLINFO ScrollInfo;
ScrollInfo.cbSize = sizeof(ScrollInfo); // size of this structure
ScrollInfo.fMask = SIF_ALL; // parameters to set
ScrollInfo.nMin = 0; // minimum scrolling position
ScrollInfo.nMax = 100; // maximum scrolling position
ScrollInfo.nPage = 40; // the page size of the scroll box
ScrollInfo.nPos = 0; // initial position of the scroll box
ScrollInfo.nTrackPos = 0; // immediate position of a scroll box that the user is dragging
m_VScrollBar.SetScrollInfo(&ScrollInfo);
</code>

VScrollBar is defined in the header

now just override OnSize:
<code>
COleControl::OnSize(nType, cx, cy);
int size=GetSystemMetrics(SM_CXVSCROLL);
m_VScrollBar.SetWindowPos(NULL,cx-size,0,size,cy-size,SWP_NOZORDER);
</code>

and handle the scroll events

------------------------
dev at viewmoresoft.com
tools for your database
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top