|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Jase Wolfe
|
Sep 4, 2007 - 2:47 PM
|
I’m trying to override a CListCtrl OnNcPaint and paint a control frame to match the Prof-UIS frames. I’ve missing something because the frame doesn’t seem to be drawing correctly in all instances.
The code
void CExtListCtrl::OnNcPaint() { // TODO: Add your message handler code here // Do not call CListCtrl::OnNcPaint() for painting messages
CRect rcWindow; GetWindowRect( &rcWindow ); ScreenToClient( &rcWindow ); rcWindow.DeflateRect( 2, 2, -1, -1 );
CDC *pDC = GetWindowDC();
//pDC->Draw3dRect( rcWindow, RGB( 0, 0, 0 ), RGB( 0, 0, 0 )); CExtPaintManager::PAINTCONTROLFRAMEDATA _pcfd ( NULL, rcWindow, false, true, true, false, false );
g_PaintManager->PaintControlFrame( *pDC, _pcfd );
ReleaseDC( pDC ); }
It’s especially not functional in native XP theme as the first column in the CListCtrl completely disappears until the control is resized or the second column is dragged to the left to force a resize of the first column.
Perhaps I am using this function incorrectly, or maybe this function shouldn’t be used at all?
Is there a way to draw control frames with the themes applied?
|
|
Technical Support
|
Sep 5, 2007 - 12:56 PM
|
The client area should be excluded from the window DC before painting into it and memory DC should be used for flicker free painting. Here is how the WM_NCPAINT message should be handled for paining the window non-client area: #if (!defined __EXT_MEMORY_DC_H)
#include <../Src/ExtMemoryDC.h>
#endif
void CYourControl::OnNcPaint()
{
CRect rcClient, rcBar;
GetClientRect( rcClient );
ClientToScreen( rcClient );
GetWindowRect( rcBar );
rcClient.OffsetRect( -rcBar.TopLeft() );
rcBar.OffsetRect( -rcBar.TopLeft() );
CWindowDC dcRealWindow( this );
dcRealWindow.ExcludeClipRect( &rcClient );
CExtMemoryDC dc( & dcRealWindow, &rcBar );
// TO-DO: paint into dc here
PmBridge_GetPM()->OnPaintSessionComplete( this );
}
|
|