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 General Discussion » Transparent Buttons Collapse All
Subject Author Date
Dan Heinz Jul 4, 2004 - 11:02 AM

Hi,


I’m having some troubles with transparent buttons and Prof.  I’m using CButtonST from Code Guru for transparency as well as a transparent frame class derived from CButton.  Both of these work fine when my XP theme is set to normal.  When I set the theme to Windows Classic the buttons have issues.  It appears they grab the rectangle behind them and store this in a bitmap – this bitmap is then displayed on the button to make it appear transparent.  But the bitmap they are grabbing is from behind the dialog they are on and not the actual dialog.  So I end up with buttons showing whatever was behind the dialog I just created. 
I’m guessing prof has not drawn the main dialog yet when the buttons are created so they don’t grab the proper background?  Any ideas?  Should I have them refresh the bitmap somewhere such as when OnActivate is fired?

Dan Heinz Jul 4, 2004 - 11:05 AM

Forgot to add:  The dialog these are on is CExtResizableDialog - they work fine on a normal CDialog.

Technical Support Jul 7, 2004 - 8:49 AM

Dear Dan,

It seems we do not have transparent buttons so far if you mean such buttons. If you send us your test project, we will help you implement what you need.


Besides, you may have noted that the transparent version of CButtonST is not designed for the flickering-free resizable windows.

Technical Support Jul 9, 2004 - 9:21 AM

Dear Dan,

The transparent version of CButtonST is not consistent with Prof-UIS dialogs when the Office 2003 theme is applied.

So, the easiest way to resolve the issue is to make some changes in the CButtonST source code. The minimum changes are:

  • Replace the CButtonST::PaintBk method with
    void CButtonST::PaintBk(CDC* pDC)
    {
       CRect rcClient;
       GetClientRect(rcClient);
        bool bTransparent = false;
       if( g_PaintManager->GetCb2DbTransparentMode( this ) )
       {
          if( g_PaintManager->PaintDockerBkgnd( *pDC, this ) )
             bTransparent = true;
          } // if( GetCb2DbTransparentMode( pWnd ) )
       if( ! bTransparent )
          pDC->FillSolidRect(
         &rcClient,
          g_PaintManager->GetColor( 
             CExtPaintManager::CLR_3DFACE_OUT
          )
          );
    } // End of PaintBk
  • If you use a resizable dialog, you should redraw CButtonST buttons when the dialog is resized. So, please implement the WM_WINDOWPOSCHANGED message handler:
    void CTransparencyDlg::OnWindowPosChanged
             (WINDOWPOS FAR* lpwndpos) 
    {
       CExtResizableDialog::OnWindowPosChanged(lpwndpos);
       m_buttonST.Invalidate();
    }

We sent you a modified project by e-mail.

Dan Heinz Jul 9, 2004 - 3:43 PM

Works like a charm!  Thanks so much - your tech support is fantastic.