From: Robert M. <rm...@po...> - 2006-01-03 22:13:40
|
Steve Loughran wrote: > Hi all > > I have only been playing with Win32::Gui for about 11 hours so far, but > its doing almost everything I want it to do so far (windows, buttons, > -onEVENT, hooking it into Win32:GuiTest, all works great...) Cool! > ... but, like most newbies, there are always some things that elude me: > > Question #1: Can Button objects have a foreground and background color? > It doesnt seem to work for me (no idea why) Sadly not. The foreground/background colours of most controls are handled internally by processing the WM_CTLCOLOREDIT/WM_CTLCOLORSTATIC/WM_CTLCOLORBTN/WM_CTLCOLORLISTBOX messages. Although the WM_CTLCOLORBTN message looks promising, the microsoft documentation says: "The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message." See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/wm_ctlcolorbtn.asp > Question #2: Can the font and color in Button objects be chosen? I'm not sure about font. Have you tried creating a new font object, and passing it to the button constructor with a-font option? If not, then the answer is still yes, but not easily - you'll need to process the NM_CUSTOMDRAW messages for the button. The MSDN details are at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/wm_ctlcolorbtn.asp and you'll find an example of how do do (simple) custom draw for a list view at http://perl-win32-gui.sourceforge.net/cgi-bin/wiki.cgi?Change_Listview_Item_Color See how you get on, and show us where you got to if you need more help. I have not personally looked at customdraw with buttons, but it may be that you have to do all the drawing yourself. Regards, Rob. -- Robert May Win32::GUI, a perl extension for native Win32 applications http://perl-win32-gui.sourceforge.net/ |