VC++ MDI

Started by
1 comment, last by TwisteR 22 years, 8 months ago
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---------- -----------------------------
------------------------------------Mitch Mulholland----------A.K.A.= TwisteR---------------------------------------
Advertisement
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
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
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

This topic is closed to new replies.

Advertisement