Jump to content
  • Advertisement
Sign in to follow this  
evilsoft

Static controls in win32

This topic is 4698 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 am working on a level creating application and am having problems with my Text Static controls. The backround color of the static is a bit lighter then the form color. Is there a way to change the back color of the static control to match the form color. Static control:
//Name Static
hNameLbl = CreateWindowEx (0,"Static","Name:",WS_CHILD|WS_VISIBLE|SS_SIMPLE,
                                75,55,50,20,hwnd,NULL,GetModuleHandle(NULL),NULL);

WinClass:
wincl.hInstance = hThisInstance;
wincl.lpszClassName = APPNAME;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);

wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;                 
wincl.cbClsExtra = 0;                      
wincl.cbWndExtra = 0;                      
wincl.hbrBackground = (HBRUSH)COLOR_MENU+3;

Share this post


Link to post
Share on other sites
Advertisement
Sorry for the ignorence, but what do I put in the handler to use the brush passed in the wparam?
I am fairly new to WIN32...I usually do tools, forms, etc in VB, so it is cake...but I found I like the control the winAPI offers, so I decided to take the C route.

Share this post


Link to post
Share on other sites
SelectObject(wParam, CreateSolidBrush(#, #, #)); to set the brush color for the static controls device context. Then use GDI paint functions to paint.

Share this post


Link to post
Share on other sites
Quote:
Original post by xeddiex
SelectObject(wParam, CreateSolidBrush(#, #, #)); to set the brush color for the static controls device context. Then use GDI paint functions to paint.


Are the '#'s RGB values?

Share this post


Link to post
Share on other sites
CreateSolidBrush takes a COLORREF. That in turn is usually created by the RGB macro which takes red, green, and blue levels in the range of 0-255.

However, since you're not using an explicit color but are instead using a system color (COLOR_MENU + 3 to be exact, which is a really wierd thing to do, what are you actually trying to accomplish with that?) you should probably use GetSysColorBrush instead.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anon Mike
CreateSolidBrush takes a COLORREF. That in turn is usually created by the RGB macro which takes red, green, and blue levels in the range of 0-255.

However, since you're not using an explicit color but are instead using a system color (COLOR_MENU + 3 to be exact, which is a really wierd thing to do, what are you actually trying to accomplish with that?) you should probably use GetSysColorBrush instead.


I started on COLOR_MENU+1 and kept incrementing and re-compling until I found the color I wanted..I found COLOR_APPWORKSPACE + 1 is the actual color I was looking for...Thanks for the function...works like a charm.

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!