Jump to content
  • Advertisement
Sign in to follow this  
Illuminate

Background problems

This topic is 4728 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

I make a simple window by using win32. I use WNDCLASSEX and the method CreateWindowEx:
HWND myWnd;
WNDCLASSEX WndClass;
...
WndClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
WndClass.lpszClassName = "MyWindow";
...
RegisterClassEx(&WndClass);
myWnd = CreateWindowEx(WS_EX_APPWINDOW, "MyWindow",...,NULL, hInstance,...);

Everything here work perfectly and my window is created with nice gray background. But when I add a child...
HWND TextTitle;
...
TextTitle = CreateWindowEx(WS_EX_TRANSPARENT, "STATIC",..., myWnd, hInstance,...);

The WS_EX_TRANSPARENT must set an transparent backgorund of the text, so everything around the text to be the same color as whole window. But background of the STATIC is still COLOR_BTNSHADOW. How can I set background of static to be the same as background of window ?

Share this post


Link to post
Share on other sites
Advertisement
You can't. You can use WM_CTLCOLOR to apply the same single color as the background window. If you want any image of the parent window you're better off to draw the text in WM_PAINT or better WM_ERASEBKGND of the parent.

WS_EX_TRANSPARENT does not to what most people think. It does not tell windows to ignore the background of the control. It actually means that if a window below gets repainted your window gets repainted as well.

Share this post


Link to post
Share on other sites
Nothing of this will work (I've tried WM_ERASEBKGND). This is because system draws background of STATICs - COLOR_BTNSHADOW and EDITs COLOR_WINDOWFRAME (White). I must use SS_OWNERDRAW style and draw the static text with background I want. The problem is I don't know exactly how to draw a STATIC, BUTTON or any other controls. :( Where can find some information about this ???

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!