Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drawing and Painting

2 views
Skip to first unread message

Bert Bruggeman

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
CDC is a class to handle HDC.. you can use dc.LineTo(..) or LineTo(dc.m_hDC,...)

Hallo newsgroup,

I want to learn how to draw and paint in a view.
I looked up in the help of the Developer Studio, but I
found only things that I didn't understand.

e.g. : I wanted to draw a line. So I searched for the
           appropriate function. I found the function 'LineTo'.
           But I didn't understand the parameter which is of
           the type 'handle of a device context'. In the 'OnDraw'
           function is only given a device context but not a handle
           of it.

So does anybody know where to find a good introduction/tutorial/....
to learn the basics of drawing and painting in an MFC view?

thanks,
         Timo

Mike Scriven

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
I learned everything I know about MFC from "Programming Windows 95 with MFC" by Jeff Prosise (Microsoft press). It has a good tutorial on drawing and painting.
 
Mike Scriven

Scot T Brennecke

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
Do the "Scribble" tutorial that comes with VC++.

jad...@my-deja.com

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
I recommend "Programming Windows with MFC" by Jeff Prosise. This book
is published by Microsoft Press. It provides the Windows programmer a
good intro to programming with MFC, and covers COM and ActiveX. If you
need a book on progamming in Windows, "Programming in Windows" by
Charles Petzold (also by Microsoft Press) is a good choice.

IMO, of course. There may be other books that others recommend.

John


Sent via Deja.com http://www.deja.com/
Before you buy.

Igor Tandetnik

unread,
Feb 9, 2000, 3:00:00 AM2/9/00
to
A Scribble tutorial will do just fine. MSDN Library\Visual C++
Documantation\Using Visual C++\Visual C++ Tutorials\Scribble: MDI
Drawing Application

With best wishes,
Igor Tandetnik

<dirk.kl...@t-online.de> wrote in message
news:87rko1$qos$1...@news04.btx.dtag.de...

Joseph M. Newcomer

unread,
Feb 10, 2000, 3:00:00 AM2/10/00
to
A device context is something you draw on. You get access to a device
context by using a handle, called an HDC. If you do your drawing in
the OnPaint routine (where most of it should be done!) you get one by
declaring

CPaintDC dc(this);

The dc variable is of type CDC (actually a subclass of CDC), and you
use it by doing
dc.LineTo(...);
dc.MoveTo(...);
dc.TextOut(...);
etc.

If you are doing drawing outside the OnPaint handler, which is
occasionally done, you can use GetDC/ReleaseDC to get a temporary DC,
or just use
CClientDC dc(CWnd *);
where the CWnd * references a window in which you are drawing, which
gets you a DC for the client area of that window.
joe

On Thu, 10 Feb 2000 19:31:15 +0100, dirk.kl...@t-online.de wrote:

>Thank you for the 'LineTo' help.
>
>But I didn't understand yet the difference between a device context and a
>device handle.
>
>I've also two other questions:
>1) I thought that a device context have saved the properties of the output
>device.
>But why can you call the member-function 'MoveTo'. How can you move a
>device context?
>2) If I want to draw a letter which is close to the next letter (but not
>in one line) you can only see a part
> of it, 'cause there's always a "white rectangle" around the letters.
>How can I turn this property off?
>
>
>Timo
>
>
>P.S.: The others said that Scribble is a good tutorial to learn drawing
>and painting with MFC, but in my oppinion it is not,
>because it just shows how to let the user draw with the mouse. You don't
>learn anything about drawing lines, Bitmaps, fonts, ...... .

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm

0 new messages