Pane redraw doubt! |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 29 September 2008 at 12:32pm |
I have a pane P1 with heavy GDI-drawing (memory-device + bitmap used). A hidden pane H1 is then shown. When I move away the mouse pointer it closes, but the content of H1 is visible for some 2 seconds!
Try this sample:
You will see that only the obscured area of the right pane is invalidated, which is probably the best thing to do in most cases. However, why does this happen when CS_SAVEBITS is set for the window class?
I believe this is a flaw in the pane implementation!
From MSDN:
CS_SAVEBITS Saves, as a bitmap, the portion of the screen image obscured by a window of this class. When the window is removed, the system uses the saved bitmap to restore the screen image, including other windows that were obscured. Therefore, the system does not send WM_PAINT messages to windows that were obscured if the memory used by the bitmap has not been discarded and if other screen actions have not invalidated the stored image. |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Interestingly... http://msdn.microsoft.com/en-us/library/bb983830.aspx
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
CS_SAVEBITS is style for Top Level windows only. Don't apply it for Child windows.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
btw... I very recommend use cashed bitmap if you need draw a lot of stuff.
See CXTPReportControl::OnPaint() method - if nothing was changed its just print saved m_bmpCache.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I have a cached bitmap. The problem is I have to StretchBlt it...
Is there no other way to prevent the pane from being redrawn?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
your Pane is standard Window. Each window receives WM_PAINT if its content was invalidated.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
CS_SAVEBITS is style for Top Level windows only.
Disagree. I think it should be possible to set this style of all panes, just like you do in MFC. Why not add this?
More info about this peculiar class style:
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Should be, but not possible. CS_SAVEBITS can't be applied for Child windows.
Use cashed bitmap and it will save time to redraw whole window.
Closed.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |