Re: Drawing on DC



I haven't seen any. Our book "Win32 Programming" makes a pretty good stab at all the
graphics APIs [shameless plug] but it still only scratches the surface. There had been a
couple good Win16 graphics books, but they are all obsolete and in some ways harmful. But
the fact I haven't seen any doesn't mean they don't exist. Maybe someone else has seen a
good one.
joe

On Sun, 19 Nov 2006 07:29:01 -0800, MarcoMB <MarcoMB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:



thanks a lot Joseph, can you finally say me about a good guide to Windows
Drawing?

"Joseph M. Newcomer" wrote:

Actually, I do exactly what you describe: my display list has a Draw method and I invoke
that. I didn't want to overwhelm him, but the solution of having a draw method of the
display list is certainly the cleaner approach.
joe

On Sun, 19 Nov 2006 03:12:10 GMT, Dan Bloomquist <public21@xxxxxxxxxxx> wrote:



MarcoMB wrote:

Thanka a lot for your patience with me, i please you to understand i'm trying
to learn on myself Visual C++ studying on book etc, and it's not my true job,
i make it only for passion.So i tried to handle the static draw of my objects
in WM_PAINT message as you said, and it's ok, the solution was under my eyes
... i'm going to studing Scribble carefully following your advice...and i'll
consider all your help like gold...unfortunately i based my app on a sample
tutorial i found on book that to mantain simple learning based the object on
CObArray, but i've read what you say that it's going wrong with those type of
generic object, and use instead template class that accept only specified
type of data object like CArray.I'll try to modify my simple paint
app...thanks a lot again.

I have not looked at SRIBBLE in a while.

Joe has gotten you see that OnDraw is where it happens. The only reason
for drawing in OnMouseMove is that the mouse is captured and the window
is on top. That makes it simple to eliminate flicker and use little
processor time. The strokes are going into the container where it counts.

You may want to use typedefs. For instance in OnDraw you will see:

CTypedPtrList<CObList,CStroke*>& strokeList...

The more often you do this the more often You commit to the specific
container/method. In a header about drawing objects, (right after the
CStroke declaration in this case):

typedef CTypedPtrList<CObList,CStroke*> STROKELIST;

Here is why. In the example the doc is the container. What happens when
you want an independent generic container? You will soon have a class
that is just that and the doc is only about file io. At that the doc
could evolve to some 'project' io and know nothing about files. But you
will want to caompartmitize this stuff to make your work OO. So you will:

typedef CDrawingImage STROKELIST;

And CDrawingImageContainer does what the doc did at first.

What about the view? Same thing can apply. The view can become more
generic and if the STROKELIST is snapped in, mouse moves can be relayed
when enabled and:

void CScribbleView::OnDraw(CDC* pDC)
{
//if attached/enabled
strokeList.Draw( pDC );
//a one liner, and now it is windows portable.
}

Take a good look at OnDraw. The view really has nothing to do with
drawing. It is done with the DC. What if you want your stuff to work
with the WTL? It can without a breath.

I am not trying to overwhelm you. But this is what c++ is really about.
c++ is not an Object Oriented language, just an opportunity to program OO.

Here is a simple implementation example of a class that works with MFC,
WTL, and a plain old winmain:

https://secure.codeproject.com/opengl/EGA.asp
(the gagl class)

Start with what Joe wrote. It is about how the API works, and it applies
to all platforms as well as windows implementations.

Best, Dan.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Drawing on DC
    ... can you finally say me about a good guide to Windows ... for drawing in OnMouseMove is that the mouse is captured and the window ... The strokes are going into the container where it counts. ... I am not trying to overwhelm you. ...
    (microsoft.public.vc.mfc)
  • Re: Drawing on DC
    ... The only reason for drawing in OnMouseMove is that the mouse is captured and the window is on top. ... The strokes are going into the container where it counts. ... It is about how the API works, and it applies to all platforms as well as windows implementations. ...
    (microsoft.public.vc.mfc)
  • Re: Folder creator owner
    ... Microsoft MVP (Windows Server: Security) ... > Thank's Joe and Roger, ... > Joe: Does Microsoft had a tool that can do that? ... >> owner value inherited from container object. ...
    (microsoft.public.win2000.security)
  • Re: you wont amount me lining through your brief residence
    ... Joe, still drawing, presumes almost ... as the offender melts no matter how their variant. ...
    (sci.crypt)
  • RE: Windows Explorer
    ... Hi, Joe. ... When running on the parallel OS, the 'big' folder (which ... original Windows installation, I found that that also now ... >temporarily uninstall the PaintShop Pro software to check ...
    (microsoft.public.windowsxp.perform_maintain)