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 » Status-bar and label bug Collapse All
Subject Author Date
Offer Har Oct 22, 2006 - 3:49 PM

Dear Support,
I am trying to put a CExtLabel derived control in a status-bar pane. I want the label to have a transparent background, because I’m using Office 2007 R2 skin.
Even when setting the following styles: |WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_EX_TRANSPARENT there is no success in making the label transparent.

I tried running status-panes sample, and i see the same result.

Please explain how to make the label transparent.

Regards,
Offer

Technical Support Oct 23, 2006 - 9:43 AM

We would recommend you simply use the CStatusBar::SetPaneText() method. If you need some additional features like the text or background color, please let us know.

Offer Har Oct 23, 2006 - 9:48 AM

This is exactly what i need - to set teh text color, font etc.

Technical Support Oct 23, 2006 - 11:14 AM

Please override the OnEraseBackground() virtual method in a the CExtLabel-derived class in the following way:

void OnEraseBackground(
   CDC & dc,
   const CRect & rcClient
   )
  {
   ASSERT_VALID( this );
   COLORREF clrBackground = GetBkColor();
   bool bTransparent = false;
   if( clrBackground == COLORREF(-1L) )
   {
    CExtStatusControlBar * pWndParent = 
     DYNAMIC_DOWNCAST( CExtStatusControlBar, GetParent() );
    ASSERT( pWndParent != NULL );
 
    CRect rcPaint;
    pWndParent->GetWindowRect( &rcPaint );
    ScreenToClient( &rcPaint );
 
    CRect _rcClient( rcClient );
    ClientToScreen( &_rcClient );
    pWndParent->ScreenToClient( &_rcClient );
    
    if( pWndParent->m_bCompleteRepaint )
    {
     dc.OffsetViewportOrg( 
      _rcClient.left, 
      0 
      );
 
     bool bRet = 
      PmBridge_GetPM()->StatusBar_EraseBackground(
       dc,
       rcPaint,
       pWndParent
       );
 
     dc.OffsetViewportOrg( 
      -_rcClient.left, 
      0 
      );
 
     if( !bRet )
     {
      bool bTransparent = false;
      if( PmBridge_GetPM()->GetCb2DbTransparentMode(pWndParent) )
      {
       if( PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this ) )
        bTransparent = true;
      }
      if( ! bTransparent )
       dc.FillSolidRect( 
        &rcPaint, 
        PmBridge_GetPM()->GetColor( CExtPaintManager::CLR_3DFACE_OUT, pWndParent ) 
        );
     }
 
     INT nIndex = 
      pWndParent->CommandToIndex( IDS_PANE_LABEL );
    
     dc.OffsetViewportOrg( 
      _rcClient.left, 
      0 
      );
 
     PmBridge_GetPM()->StatusBar_ErasePaneBackground(
      dc,
      nIndex,
      rcPaint,
      pWndParent
      );
 
     dc.OffsetViewportOrg( 
      -_rcClient.left, 
      0 
      );
 
     bTransparent = true;
 
    } // if( pWndParent->m_bCompleteRepaint )
 
   }
   if( ! bTransparent )
    dc.FillSolidRect(
     &rcClient,
     (clrBackground != COLORREF(-1L)) 
      ? clrBackground 
      : PmBridge_GetPM()->GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) 
     ); 
  }

Offer Har Oct 23, 2006 - 3:11 PM

Thanks, that solved the problem.
Why is this required? Can’t the CExtLabel be transparent on any window?

Technical Support Oct 24, 2006 - 12:18 PM

The CExtLabel control itself draws its background, which is needed for displaying a correct gradient background on dialogs for certain themes. The code we provided draws a solid background when the label is inside a status bar pane.

Offer Har Oct 29, 2006 - 8:59 AM

Dear support,

When loading the black skin(CExtPaintManagerOffice2007_R2_Obsidian), the font color of the CExetLabel in the status bar is black, as opposed to the rest of my controls, or the other standard panes in the status bar.Why is this? how to change it?

Thanks.
Offer

Technical Support Oct 30, 2006 - 12:19 PM

We cannot confirm this. We added a pane with CExtLabel in the StatusPanes sample and the label text color is always when the Obsidian theme is used. You may have explicitly specified the label color. Please check this.