i was reading mfc book by jeff. i had installed vs 2005 . i tried simple programme but it does not works
just add this to onpaint
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
dc.DrawText("hi ",-1,&rect,DT_CENTER);
but there is no display in output

simple question
joesun99
void CMainWindow::OnPaint () { CPaintDC dc (this); CRect rect; GetClientRect (&rect); dc.DrawText (_T ("Hello, MFC"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); }
this the code i addded to my sdi application
i use visual studio 2005
Brian Trexler
That looks fine to me. What sort of project did you create Did you use a template What class is handling your onpaint method If you put in a breakpoint, does it get called
p4r1tyb1t
TheLastVampire
This is wrong!
I guess you created a SDI Doc View program! In this case you placed the paint code in the Main frame window. The main frame window is completely covered by your View window. Place the code into your View!
adsolo
According to an earlier post, his breakpoint in OnPaint() is not being hit.
If it's taking two days to address a simple issue, I'd start from scratch with a sample (Scribble ) that demonstrates OnPaint and then compare differences.
Wreckage8
here is message map:
BEGIN_MESSAGE_MAP(CChildView, CWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
here is onpaint part:
void CChildView::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect (&rect);
dc.DrawText (_T ("Hello, MFC"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
Greg Banister
ON_WM_PAINT()
END_MESSAGE_MAP()
this what u say
KP99
VikasVaidya
even tried to kept break point on - CPaintDC dc(this)
but it does not stop there just it runs
thanx for the reply
NUCLEAR-WAR
What color are you writing with If you're writing white on white, you won't see anything.
-Ben