Transparent Rebar/Toolbar (MFC VC++ 6.0) 
Author Message
 Transparent Rebar/Toolbar (MFC VC++ 6.0)

I'm having a little but persistent problem.
I'm trying to add a bitmap to the toolbar background  (rebar) of a new
application,
but instead off showing the bitmap, the rebar/toolbar becomes completely
transparent
(i can see the desktop).

The new MDI application is created using the MFC App Wizard (VC++ 6.0),
with
the explorer rebars option checked. I modified the code of the
CMainFrame::OnCreate()
method (see below) to add the bitmap to the toolbar background. However,
this doesn't work
and the rebar becomes transparent. I tried several other implementation
(f.e. the implementation
described in the help pages), but nothing seems to work. I also tried to
to modify the MFCIE example
application but that resulted in a transparent rebar as well. The only
example that is working is the REBAR
example.

If anyone has any idea of what I'm doing wrong or if someone has any
other suggestion to solve this problem,
please let me know.

Thanks,

Maurice van SOEST

// Begin source code.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT,

        WS_CHILD | WS_VISIBLE | CBRS_TOP, CRect(3, 3, 3, 3)) ||
        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
   {
       TRACE0("Failed to create toolbar\n");
       return -1;      // fail to create
    }
    m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() &
~CBRS_HIDE_INPLACE);

    if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
        CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
    {
        TRACE0("Failed to create dialogbar\n");
        return -1;  // fail to create
    }

    CBitmap m_bmap;
    m_bmap.LoadBitmap(IDB_COOLBG);

    if (!m_wndReBar.Create(this) ||
        !m_wndReBar.AddBar(&m_wndToolBar, NULL, &m_bmap,
RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP) ||
        !m_wndReBar.AddBar(&m_wndDlgBar, NULL, &m_bmap,
RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP))
    {
        TRACE0("Failed to create rebar\n");
        return -1;      // fail to create
    }
    m_wndReBar.SetBarStyle(m_wndReBar.GetBarStyle() &
~CBRS_HIDE_INPLACE);

    if (!m_wndStatusBar.Create(this) ||
       !m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
     }

     // TODO: Remove this if you don't want tool tips
     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
     CBRS_TOOLTIPS | CBRS_FLYBY);

     return 0;

Quote:
}

// End of source code.


Sun, 30 Sep 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. toolbars in vc++ 6.0 (new to win32 programming)

2. toolbar in vc++ 6.0

3. VC++ 6.0 , MFC 6.0?

4. LNK 2005 error when migrating from VC++ 6.0 (MFC) to VC++ .Net

5. Toolbar (IDE) positioning in VC++ 6.0

6. VC++ 6.0 slows down after using the wizard toolbar

7. About Toolbar & Rebar - when user click toolbar and rebar...-

8. backward compatibility vc++ .net vc++ 6.0

9. MDI and toolbar (or rebars)?

10. MDI and Toolbars (or Rebar)

11. vc++ 5.0 to vc++ 6.0 problem

12. coolbar/rebar seperator in toolbar

 

 
Powered by phpBB® Forum Software