Re: Inheritance and MFC
Hi Nobody,
To create a control, like a grid control, you'll likely want to start with
something similar that is already derived from a CWnd and has some of the
properties you want to use. Perhaps something like this:
http://www.codeproject.com/miscctrl/gridctrl.asp
Tom
"Nobody" <Nobody@yahoo.com> wrote in message
news:eN%237eNdvHHA.4796@TK2MSFTNGP04.phx.gbl...
Hi Tom,
You didn't post any of the code from your grid object,
I posted what was relevant.
if it is a control or displays anything I'll be it is already derived from
or contains a CWnd at some point.
It does not.
Is this an object you created...
Yes.
I guess that is what I am doing.
I am trying to create a control.
It is a control, but does not contain any controls.
I am trying to add controls to my control. i.e. Scrollbars
I noticed that the more I use the grid object, the more I have to keep
adding scroll bars for pan, zoom, etc.
So, my idea was to make a CWnd GridSB Class that implements Scrollbars.
That class inherits from the Grid CObject class.
Then, I can leave the scroll bars inside of the CGrid Object, instead of
Creating scroll bars each time.
This is basically what I have.
CGrid : public CObject
{
//Bunch of stuff
}
CGridSB: public CGrid, public CWnd
{
CScrollbar sb;
CreateScrollbars();
SetScreenRect(){ PositionScrollbars(); }
}
CView::OnDraw()
{
CGridSB sb;
sb.SetScreenRect(Rect);
sb.OnDraw(pDC);
}