Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use DrawText or TextOut

Status
Not open for further replies.

john829

Programmer
Sep 14, 1999
10
US
Either of these functions will work fine if my class is derived from CView, but when I try to use them in a class derived from CFormView, the screen stays blank. I have put the code in the OnInitialUpdate() function, but nothing happens. How can I draw text to the screen in a CFormView class?
 
Why don't you add a handler for the OnDraw method in your CFormView derived class.(with ClassWizard)

inside of it you can put:

pDC->TextOut(5,5,"test");

and you will see it works.
Anyway, what you are trying to do is not very well in MFC programming sense. Because if you draw something in OnInitialUpdate you will see it only the first time the form appears, then the OnDraw method is called each time you hide, minimize-maximize or overlap your window with another.

Probably the CFormView has a built-in call to the OnDraw method after the OnInitialUpdate, which CView doesn't.

Hope this helps,
s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top