-
January 14th, 2006, 01:10 PM
#1
OnNcPaint not called when dialog gains focus
I have an MFC dialog-based application. I have overridden the OnNcPaint method and draw some images in the non-client area of the dialog. It works just fine when, for example, some other window is in front of my dialog and that window is moved off of my dialog. But when my dialog actually gains focus, as when I click on its entry in the taskbar or click directly on my dialog, my OnNcPaint does not get called and instead it draws the default, standard images in the non-client area (i.e. the border, the title bar, etc.). How do I get it to call my overridden OnNcPaint when the dialog gains focus, so that I can assure that my painting occurs instaed of the default painting?
- Roger Garrett
-
January 15th, 2006, 01:12 AM
#2
Re: OnNcPaint not called when dialog gains focus
Lets see it has been a long while since I did this.
You need to handle four messages to modify the nonclient area.
1. WM_NCACTIVE, overide this to paint the NC area when the application is about to become inactive. just let the default occur if the dialog is becoming active.
2. WM_NCPAINT. this is where you put the code for your active dialog nc area
3. WM_SETTEXT. Send a WM_NCPAINT message to the dialog
4. WM_SYSCOMMAND. Send a WM_NCPAINT message to the dialog aftier calling the default implementation.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
March 25th, 2013, 04:38 AM
#3
Re: OnNcPaint not called when dialog gains focus
I developed a dialog box where it launches in full screen mode and I removed the system menu and used an image which acts like a button, when user clicks on it, it restore to normal mode. I have used OnNCPaint to draw the image on the dialog box. This works good in Windows 7 and earlier versions. But the image is not getting displayed in Window 8. Do I need to take care of anything else?
-
March 25th, 2013, 04:39 AM
#4
Re: OnNcPaint not called when dialog gains focus
*in windows 8 operating system
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|