Print Page | Close Window

Draw transparent toolbar?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2565
Printed Date: 27 April 2025 at 7:12am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Draw transparent toolbar?
Posted By: jeffcmj
Subject: Draw transparent toolbar?
Date 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

 




Replies:
Posted By: Oleg
Date 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


Posted By: jeffcmj
Date 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...



Posted By: Oleg
Date 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


Posted By: jeffcmj
Date 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



Posted By: Oleg
Date Posted: 13 July 2005 at 7:36am

ok, here is your sample

http://forum.codejock.com/uploads/oleg/2005-07-13_073536_BitmapBackground.zip - 2005-07-13_073536_BitmapBackground.zip



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 13 July 2005 at 7:40am
Thanks ole. I feel myself silly after seeing your sample. ;-)


Posted By: jeffcmj
Date 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



Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net