Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

IndirectX

XP-style toolbars w/controls

This topic is 5893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For my media player, I decided to put a volume trackbar on a rebar band. Unfortunately, the toolbar is gradient and the trackbar isn''t: I originally thought it''s a problem with visual styles (themes), but now I think it''s a problem with the toolbars. Any ideas how I can make my trackbar''s background match that of the toolbar? I''ve also seen similar problems with other apps.

Share this post


Link to post
Share on other sites
Advertisement
MSDN talks about a way to simulate a transparent dialog bar in a rebar band and suggests handling the WM_ERASEBACKGROUND message. Here''s the part with the code:

quote:

To implement a transparent dialog bar in a rebar band

Using ClassWizard, add a new class (for example, CMyDlgBar) that implements your dialog bar object.


Add a handler for the WM_ERASEBKGND message.


In the new handler, modify the existing code to match the following example:
BOOL CMyDlgBar::OnEraseBkgnd( CDC* pDC )
{
CWnd* pParent = GetParent();
ASSERT_VALID(pParent);
CPoint pt(0, 0);
MapWindowPoints(pParent, &pt, 1);
pt = pDC->OffsetWindowOrg(pt.x, pt.y);
LRESULT lResult = pParent->SendMessage(WM_ERASEBKGND,
(WPARAM)pDC->m_hDC, 0L);
pDC->SetWindowOrg(pt.x, pt.y);
return lResult;
}

Add a handler for the WM_MOVE message.


In the new handler, modify the existing code to match the following example:
BOOL CMyDlgBar::OnMove( int cx, int cy )
{
Invalidate();
}

The new handlers simulate the transparency of the dialog bar by forwarding the WM_ERASEBKGND message to the parent window and forcing a repaint every time the dialog bar object is moved.



I would think you should be able to modify that to work with a trackbar.



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm

Share this post


Link to post
Share on other sites
Check out www.codeproject.com, they have a lot of these fancy controls.

+++ Corvus +++

[edited by - Corvus on July 1, 2002 4:14:31 AM]

[edited by - Corvus on July 1, 2002 4:15:12 AM]

[edited by - Corvus on July 1, 2002 4:15:30 AM]

Share this post


Link to post
Share on other sites
I can''t get it to work. SendMessage returns 1, but it looks like nothing is erased. If I write my own do-nothing WM_PAINT handler for the trackbar, then nothing is erased/painted at all (you see whatever previous window was in the trackbar''s place). I tried writing empty erase-background handler, and it appears that trackbar''s WM_PAINT handler erases its client area anyway (same picture as the screenshot). I tried WS_EX_TRANSPARENT for the trackbar, but that doesn''t seem to have any effect on painting code (same picture again).

I''ve been to codeproject and other places, but I can''t find anything relevant. Can you maybe give me some good query words?

Has anyone seen properly painted controls (font selection text boxes, for example) in my circumstances at all? I''m starting to think that what I''m doing requires owner-draw.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!