Draw on the none-client area [modified]
-
I want to draw on the none-client area(acturely on the title bar).So,I implement the WM_NCPAINT message by OnNcPaint(); But now,I wan to modify the title height to ajust a bitmap. What should I do? Thanks. GOOD LUCK
Calling OnNcPaint() directly won't work; you must let the system call it so that you know it has invalidated the right area. I'm not sure why it doesn't call your OnNcPaint() handler when going inactive; I suspect it is a bit of a loophole in the MFC framework whereby it doesn't behave consistently. Perhaps if you tell us why you are trying to paint in this area, we can suggest an alternative approach? Trying to override the system is always erratic at best {:v)
-
I want to draw on the none-client area(acturely on the title bar).So,I implement the WM_NCPAINT message by OnNcPaint(); But now,I wan to modify the title height to ajust a bitmap. What should I do? Thanks. GOOD LUCK
WM_NCCALSIZE..
nave [OpenedFileFinder]
-
Calling OnNcPaint() directly won't work; you must let the system call it so that you know it has invalidated the right area. I'm not sure why it doesn't call your OnNcPaint() handler when going inactive; I suspect it is a bit of a loophole in the MFC framework whereby it doesn't behave consistently. Perhaps if you tell us why you are trying to paint in this area, we can suggest an alternative approach? Trying to override the system is always erratic at best {:v)
-
WM_NCCALSIZE..
nave [OpenedFileFinder]
-
Overide the WM_NCCALSIZE, and in the OnNcCalcSize() function, you will get rect of the dialog
pstncsp->rgrc[0]
And that rect contains you present client area. So if you wanne increase the nonclient area, decrease the client area. Say in your case you want to increase the no client area on the top. For that do do as follows.. void MyDlg::OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* pstncsp ) { CDialog::OnNcCalcSize( bCalcValidRects_i, pstncsp_i ); pstncsp_i->rgrc[0].top += 50;// Increases the non client area by 50 }nave [OpenedFileFinder]
-
Overide the WM_NCCALSIZE, and in the OnNcCalcSize() function, you will get rect of the dialog
pstncsp->rgrc[0]
And that rect contains you present client area. So if you wanne increase the nonclient area, decrease the client area. Say in your case you want to increase the no client area on the top. For that do do as follows.. void MyDlg::OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* pstncsp ) { CDialog::OnNcCalcSize( bCalcValidRects_i, pstncsp_i ); pstncsp_i->rgrc[0].top += 50;// Increases the non client area by 50 }nave [OpenedFileFinder]