Archived

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

TwisteR

MDI drawing problems

Recommended Posts

I am using Microsoft Visual C++ 6.0 and have made a MDI and I want to display a line on the screen.....I have tried several ways and the all have failed..They compile fine, but, no line...........Please try to help me!!! I will give you examples of what i tried = C_____View::Draw(CDC* pDC) { .......compiler givin code here.......... pDC->MoveTo(100,200); pDC->LineTo(200,200); .......here to............ } BOOL C____Doc::OnNewDocument() { ..compiler givin code.... CLine *pLine = new CLine(CPoint(100,200), CPoint(200,200)); m_oaLines.Add(pLine); return TRUE; } Those are just two.. i have tried many more!!!!! Please help!!!!!!!!!!!!!!! ----------------------------- -------Mitch Mulholland------ ----A.K.A.= TwisteR---------- ----------------------------- Edited by - felisandria on July 31, 2001 11:41:24 AM

Share this post


Link to post
Share on other sites
First off you really should get an MFC book and learn how to make the compiler do all the work for you. You''re going about it all wrong. You''re supposed to work with the IDE, not just try to do it from scratch

That being said: CDocument doesn''t draw stuff. It has nowhere to do so, it has no device context.

I''m assuming your C___View is derived from CView. You need to message map (MFC''s expected message map, between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP) ON_WM_PAINT() and use OnDraw as your function rather than just Draw. Your C__View also has to be template defined to be the original view template for the document, or explicitly created as a frame/view pair.

Final point: stop yelling and use a title that makes sense.

-fel

Share this post


Link to post
Share on other sites