derive from CWnd?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Each item in a dialog is derived from CWnd (e.g. a static control, a list
box, a combo box, etc). I am trying to determine whether the same approach
can be used to draw objects in a CView. As a simple example, assume 5
different non-overlapping objects (e.g. 5 circles) are drawn in a CView.
Each object knows how to draw itself and respond to keyboard/mouse input.
The question is, should each object be derived from CWnd? Alternatively,
should each object simply receive a pointer to CView and "USE" this pointer
to draw itself? The latter is the approach I have traditionally taken. Is
there is good reason to use the former approach and have each object be
derived from CWnd? I have no idea how to implement the details (e.g. how to
ensure a selected object receives keyboard/mouse input) so, if this approach
can be implemented, could someone please refer me to any documentation that
describes how it is done?

Thanks in advance

Ian


.



Relevant Pages

  • Re: derive from CWnd?
    ... about hundreds of objects on the drawing. ... The alternative is to have each object have a virtual "Draw" method. ... a pointer to a CView; you'd most likekly pass a CDC * or CDC & into it. ... should each object be derived from CWnd? ...
    (microsoft.public.vc.mfc)
  • Re: derive from CWnd?
    ... Ian wrote: ... I am trying to determine whether the same approach can be used to draw objects in a CView. ... assume 5 different non-overlapping objects are drawn in a CView. ... Is there is good reason to use the former approach and have each object be derived from CWnd? ...
    (microsoft.public.vc.mfc)
  • Re: derive from CWnd?
    ... Ian ... > approach can be used to draw objects in a CView. ... Each object knows how to draw itself and respond to keyboard/mouse ... should each object be derived from CWnd? ...
    (microsoft.public.vc.mfc)
  • Re: Drawing lines in a CListCtrl
    ... I would simply use a CWnd or CStatic as the container. ... As far as drag and drop goes. ... container owns, and draw them. ...
    (microsoft.public.vc.mfc)
  • Re: MFC GetParent CWnd* return
    ... What they mean is that the CWnd * returned might be a pointer to a temporary ... then pStatic will either be NULL (because there is no such child window), ... The framework doesn't really cache values, it just keeps track of what CWnd ...
    (microsoft.public.vc.mfc)