You can both repaint the non-client area and change its size. You can find an example of a custom non-client area in the TabbedBars sample.
There is a CExtControlBar::g_nMsgCustomNcAreaQuery
registered message that is sent each time when the non-client area of a control bar is measured or painted. This feature is turned off by default (the message is not sent), but you can turn it on by setting the following property somewhere at startup (e.g., in the main frame’s constructor) to true
:
CExtControlBar::g_bUseCustomNcArea = true;
In the
TabbedBars sample, this message is handled in the
CMainFrame::OnMsgUseCustomNcArea()
method. Your handler may look like as follows
LRESULT CMainFrame::OnMsgUseCustomNcArea( WPARAM wParam, LPARAM lParam )
{
ASSERT_VALID( this );
lParam;
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA * pCNAQD =
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA::FromWPARAM( wParam );
ASSERT( pCNAQD != NULL );
ASSERT_VALID( pCNAQD->m_pBar );
if( pCNAQD->m_pBar->IsFixedMode() )
return 0;
pCNAQD->m_bQueryHandled = true; // let the resizable bar know that its query is processed
if( pCNAQD->m_hDcDraw != NULL )
{ // if rendering query
. . .
} // if rendering query
else
{ // if metric update query
. . .
} // if metric update query
return 0;
}
Here is the version that allows you to set only a custom size
LRESULT CMainFrame::OnMsgUseCustomNcArea( WPARAM wParam, LPARAM lParam )
{
ASSERT_VALID( this );
lParam;
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA * pCNAQD =
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA::FromWPARAM( wParam );
ASSERT( pCNAQD != NULL );
ASSERT_VALID( pCNAQD->m_pBar );
if( pCNAQD->m_pBar->IsFixedMode() )
return 0;
if( pCNAQD->m_hDcDraw != NULL )
return 0;
pCNAQD->m_bQueryHandled = true;
pCNAQD->m_pBar->_SeparatorWidthSet( 2 );
pCNAQD->m_pBar->_SeparatorHeightSet( 2 );
return 0;
}