Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

defining an RGB value in........

Status
Not open for further replies.

ShaunS

IS-IT--Management
Jul 30, 2004
1
GB
hey,
i am building a windows app with borland cpp. I want to know how i can define the background of the app to a certain color (AN RGB VALUE), not just the windows default. Would you do it somehow like this?

hbr.Background = (BRUSH)GetStockObject.........

I am really stuck on this one. Plese, any help.
 
You should paint it on WM_PAINT handling. John Fill
1c.bmp


ivfmd@mail.md
 
If you're looking to make it a selectable option. I would suggest using a SetBkColor call within the WM_PAINT message. You can assign your RGB color value to the HDC.

 
If you aren't using the hbrBackground parameter in the WNDCLASS structure, I'd look at the WM_ERASEBKGND message.

Do something like:
[tt]
case WM_ERASEBKGND:
[tab]hdc = (HDC) wParam;
[tab]GetClientRect(hwnd, &rc);
[tab]// Do your painting here
[tab]// (like a FillRect, etc)
[tab]return 1L;
[/tt]

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top