Drawing a Caption using CDC Class
-
Hi I am trying to write a caption to my modeless dialog box I did a getwindowrect and screen to client as the negative "y" coordinates would be where I would want to place my text did dc->Setcolor to blue got my text extents from CDC When I did a dc->textout nothing happened I also noticed Cwnd has DrawCaption but doesnt take a parameter for Text. DrawText however has a DT_TEXT flag but where does it pick up the text Can you write a caption using a device context Thanks
-
Hi I am trying to write a caption to my modeless dialog box I did a getwindowrect and screen to client as the negative "y" coordinates would be where I would want to place my text did dc->Setcolor to blue got my text extents from CDC When I did a dc->textout nothing happened I also noticed Cwnd has DrawCaption but doesnt take a parameter for Text. DrawText however has a DT_TEXT flag but where does it pick up the text Can you write a caption using a device context Thanks
It sounds like you are trying to write in the title bar of the window - is that right? The easy way is to call
SetWindowText()
on the dialog box HWND (or do whatever the MFC equivalent is) and let the default dialog proc handle drawing your text. Otherwise you would have to draw in the non-client area, which has its ownWM_NCPAINT
message to handle. -
It sounds like you are trying to write in the title bar of the window - is that right? The easy way is to call
SetWindowText()
on the dialog box HWND (or do whatever the MFC equivalent is) and let the default dialog proc handle drawing your text. Otherwise you would have to draw in the non-client area, which has its ownWM_NCPAINT
message to handle.thanks I choose the later NC_CLIENT might I ask you a few follow up questions 1) is there a way to determine the NC area,like GetWindowNCRect. In Additon TextOut is giving me issues would I be better off using DrawText would it need to be preceded by DrawCaption Not sure as if you could steer me the right direction would appreciate it