Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Draw transparent toolbar?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Draw transparent toolbar?

 Post Reply Post Reply
Author
Message
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Topic: Draw transparent toolbar?
    Posted: 12 July 2005 at 3:42am

Hi,

Does anyone know how to make toolbar transparent? I mean the toolbar's uses the background filled via FillDockBar.

Best

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 July 2005 at 7:09am

See code of void CXTPNativeXPTheme::FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar)

it can help...

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 12 July 2005 at 8:48pm

This code seems use the same function to draw both of them. It works well with solid background, but what if the background is a picture? What I want is the thing like MFC toolbar on the rebar, with whom I can draw a picture on the rebar and make toolbar transparent, then the toolbar button will show on the picture.

Thanks

Originally posted by oleg oleg wrote:

See code of void CXTPNativeXPTheme::FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar)

it can help...

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2005 at 5:17am

In FillCommandBarEntry you must draw part of this picture to make it look like transparent.

Windows doesn't allow to make child window transparent.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2005 at 5:55am

In my previous project, I use this trick to let parent window draw child window.

  CPoint pt (0, 0);
  pWnd->MapWindowPoints (pParent, &pt, 1);
  pt = pDC->OffsetWindowOrg (pt.x, pt.y);

  bRes = (BOOL) pParent->SendMessage (WM_ERASEBKGND, (WPARAM)pDC->m_hDC);

  pDC->SetWindowOrg(pt.x, pt.y);

But it does not work with XTP, because XTP draws the DockBar in OnPaint, not OnEraseBkgnd, any suggestion?

Thanks

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2005 at 7:36am

ok, here is your sample

2005-07-13_073536_BitmapBackground.zip

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2005 at 7:40am
Thanks ole. I feel myself silly after seeing your sample. ;-)
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2005 at 11:44pm

Sorry for bring this thread back.

I still think XTP command bar shall redraw the background in OnErase handler. For example, I have another control placed on the bar, if XTP's bar redraw the background in OnErase handle, then I only need to use the following code to make my control transparent:

CPoint pt (0, 0);
  pWnd->MapWindowPoints (pParent, &pt, 1);
  pt = pDC->OffsetWindowOrg (pt.x, pt.y);

  bRes = (BOOL) pParent->SendMessage (WM_ERASEBKGND, (WPARAM)pDC->m_hDC);

  pDC->SetWindowOrg(pt.x, pt.y);

The big advantage of this way is the control actually not even know it's parent is the XTP bar, thus makes the control more independent.

Best

Jeff

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2005 at 12:00am

Hi,

Standard controls and CommandBars too supports WM_PRINT message.

instead bRes = (BOOL) pParent->SendMessage (WM_ERASEBKGND, (WPARAM)pDC->m_hDC);

try

pParent->Print(pDC, PRF_CLIENT);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.078 seconds.