Archived

This topic is now archived and is closed to further replies.

TwisteR

VC++ MDI

Recommended Posts

Hi i have 2 questions. #1 = How do i go about drawing a line (that the user didn''t draw) in a multiple Document Inerface. please not that the moveto() lineto() does not work. #2 = My program has several drawing options (circle, line, sqaure, curve, text). how do I set the default one to be chosen? Thank you. ----------------------------- -------Mitch Mulholland------ ----A.K.A.= TwisteR---------- -----------------------------

Share this post


Link to post
Share on other sites
Hmm.

Well, I guess I need to ask where exactly you''re trying to draw stuff.

You see, the actual document is meant for data storage. It''s not really "allowed" to draw stuff, it doesn''t really have a device context that you''re free to use, really.

The thing you want to draw in is a view. You basically need to derive a class from CView, and create an instance of the view when you start up your app. Then you can override the WM_PAINT and various mouse messages for the view. In the OnDraw you can then do whatever line or primitive drawing you want.

There are some good resources on doing this sort of thing on Codeguru. For GDI info, go to:
http://www.codeguru.com/gdi/index.shtml
I would also check out some of the sample apps in the miscellaneous section if you''re having problems figuring out how to implement this.

-fel

Share this post


Link to post
Share on other sites
What do you mean moveto lineto doesnt work?

As Felisandria mentioned, make sure that you are attempting to draw inside your CViews OnDraw method or as a response to a WM_PAINT message. Initiating drawing code at any random point will not necessarily work.

Also make sure that you are not drawing with the same color as the background of your window. lol. Obviously this will not produce a visible line...

But MoveTo LineTo works great for drawing lines as long as you are not trying to create a fast 3D wireframe engine using it. lol

Seeya
Krippy

Share this post


Link to post
Share on other sites