Scrolling ActiveX control
Posted on 2004-11-02
I’m relatively new to C++ and I’m taking my first tentative steps in to ActiveX. Using the App Wizard in Visual Studio.net, I have created an MFC ActiveX Control called ‘TestAX’.
The only modification I have made to it, is in the ‘CTestAXCtrl’ class I have changed the default OnDraw function so that the background rectangle and ellipse are drawn twice as big as the control itself. Shown below.
void CTestAXCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
// TODO: Replace the following code with your own drawing code.
pdc->FillRect(rcBounds * 2, rush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
pdc->Ellipse(rcBounds * 2);
My question is: how difficult is it to add scroll bars to the control so that the whole ellipse can be viewed. The direct base class ‘COleControl’ has a ‘ScrollWindow()’ function but if I call this in the constructor of CTestAXCtrl I get a runtime error. Same gose for the ‘ShowScrollBar()’ in the indirect base class ‘CWnd’.
Am I barking up completely the wrong tree? Its just I can’t seem to find any simple examples of this anywhere!