- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't set the colors in design-time (in resource editor). If VB can do it, that's because it has its own dialog box/form window class. Dialog and control colors are implemented in a clumsy way in windows API -- for most controls, there's no (equivalent of) WM_SETCOLOR/WM_SETBKCOLOR. Instead, the colors should be adjusted by handling WM_CTLCOLOR* messages and setting the colors by selecting brush on given DC. If you're not careful, you can easily get a GDI resource leak.
I developed a custom solution long time ago by tweaking DFLOGM module and calling it XFLOGM. Later, that solution became a part of my Xeffort library, but written from scratch.
See here as the starting point.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See these links about changing system parameters, such as dialog box background, button colours. You need to use GetSysColor and SetSysColor API functions. Remember, they are system colors, so the colors will change inALL the objects of a given type that you modify, not just those connected with your application.
Otherwise, Jugoslav describes the way to go where you have to be able to intercept thewindows messageto draw a control, from the control ID get a handle to its window, get its device context (DC), change the brush to the colour you want , release the DC and pass on the message to draw the control to the default window procedure. I think all this requires sub-classing each control in each dialogfor whichyou want to choose the color,(during processing of the WM_CREATE message for the dialog) which means inserting your own procedure into the windows message loop for a dialog window using SetWindowLong, doing the above and then passing the message on to the default windows procedure.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsyscolor.asp
Message Edited by anthonyrichards on 11-09-2005 01:31 AM
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page