Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » Control Bar frame Collapse All
Subject Author Date
Offer Har Mar 21, 2007 - 12:09 PM

Dear Support,
Is there a way to change to width of the control bar frame width? currently it is 4 pixels, and I would like to take it down to 2.
Thanks...
Ron.

Technical Support Mar 22, 2007 - 1:13 PM

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;
}


Offer Har Mar 22, 2007 - 2:05 PM

Thanks, problem solved.