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 » Toolbar in IE Collapse All
Subject Author Date
Andrew Nanopoulos Apr 6, 2006 - 12:11 PM

You wrote in another thread:"Additionally we advise you to change the design of your IE embedded bar because Prof-UIS toolbars have a different style. It is possible to subclass the IE-bar which is inserted directly into the rebar common control. You can subclass the IE toolbar window with the CExtToolControlBar class. As a result you will have a solid Prof-UIS-based bar inside IE."

Could you elaborate on this? Is there a way to inherit the rendering mode of the "system" so the style always matches IE?

Technical Support Apr 6, 2006 - 12:38 PM

We mean that it is possible to subclass the IE rebar band window which looks like a toolbar with the current windows style. After subclassing this bar and its content, it will have a solid look of any theme supported in Prof-UIS. But, as a result, you will get an IE toolbar with the style different to all other IE toolbars.

Andrew Nanopoulos Apr 6, 2006 - 6:43 PM

Could you give me a simple class declaration of what you mean?

Andrew Nanopoulos Apr 6, 2006 - 6:45 PM

Are you saying that I should not use the CExtToolControlBar? that I cant make it look like a standard ie toolbar? Sorry for being so thick...

Technical Support Apr 7, 2006 - 6:58 AM

We did the trick and now the background of your IE toolbar is drawn correctly. Please declare a CExtToolControlBar-derived class (e.g. CKBToolbarWnd) and override the DoEraseBk() virtual method in this way (the full source code can be downloaded from here):

void CKBToolbarWnd::DoEraseBk( CDC * pDC )
{
 ASSERT( pDC->GetSafeHdc() != NULL );
 
CRect rcClient;
 GetClientRect( &rcClient );
 
 if( ::IsRectEmpty( &rcClient )
  || ( ! pDC->RectVisible( &rcClient ) )
  )
  return;
 
CWnd * pWndParent = GetParent();
 ASSERT( pWndParent != NULL );
 ASSERT_VALID( pWndParent );
 
CRect rcParentWnd;
 pWndParent->GetWindowRect( &rcParentWnd );
 ScreenToClient( &rcParentWnd );
 
bool bDefaultDrawing = true;
 if(  g_PaintManager.m_UxTheme.IsAppThemed()
  && g_PaintManager.m_UxTheme.IsThemeActive()
  && g_PaintManager.m_UxTheme.OpenThemeData(
    GetSafeHwnd(),
    L"REBAR"
    ) != NULL
  )
 {
  INT nPartID = 0;
  INT nStateID = 0;
  if( g_PaintManager.m_UxTheme.DrawThemeBackground(
    pDC->GetSafeHdc(), 
    nPartID, 
    nStateID, 
    &rcParentWnd, 
    &rcClient
    ) == S_OK
   )
   bDefaultDrawing = false;
  g_PaintManager.m_UxTheme.CloseThemeData( true );
 }
 
 if( bDefaultDrawing )
  pDC->FillSolidRect(
   &rcClient,
   ::GetSysColor( COLOR_3DFACE )
   );
}

Andrew Nanopoulos Apr 7, 2006 - 8:57 AM

Fantastic!!! Works like a charm, Thanks