From: Jeremy W. <jez...@ho...> - 2006-02-19 09:13:13
|
Hi Chris, >Quick question (hopefully) when adding a toolbar and setting an imagelist >to it, and then adding bitmaps to each button when you change the property >of the button to grayed => 1 the image disappears and it ends up a big >grey >square but no image. > > > >What image gets called displayed here and what format is it supposed to be >in??? The code I use is below - how or why it works I'm not sure:) I have three bitmaps. OBJECTTB is the normal bitmap for the buttons (24 bits), OBJECTTBM, the mask for this bitmap (24 bits) and OBJECTTBD which is the bitmap that is used when a button in the toolbar is disabled (8 bit). Why this image is 8 bits I dont know:) my $tbbitmap = new Win32::GUI::Bitmap('OBJECTTB'); $tbbitmap = new Win32::GUI::Bitmap(cwd.'\Art\OBJECTTB.bmp') unless $tbbitmap; my $tbbitmapdis = new Win32::GUI::Bitmap('OBJECTTBD'); $tbbitmapdis = new Win32::GUI::Bitmap(cwd.'\Art\OBJECTTBD.bmp') unless $tbbitmapdis; my $tbbitmapmask = new Win32::GUI::Bitmap('OBJECTTBM'); $tbbitmapmask = new Win32::GUI::Bitmap(cwd.'\Art\OBJECTTBM.bmp') unless $tbbitmapmask; $toolbarIL = new Win32::GUI::ImageList(16, 16,1| 0x0010, 3, 20); $toolbarILM = new Win32::GUI::ImageList(16, 16,1| 0x0010, 3, 20); $toolbarIL->Add($tbbitmap,$tbbitmapmask); $toolbarILM->Add($tbbitmapdis,$tbbitmapmask); $mainTB=Win32::GUI::Toolbar->new( -parent => $rb, -nodivider => 1, -pushstyle => CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_FLAT|1|TBSTYLE_TOOLTIPS, -onButtonClick => sub {ToolbarAction($_[1]);}, ); $mainTB->SetImageList($toolbarIL); $mainTB->SetDisabledImageList($toolbarILM); $mainTB->AddButtons( ...); to disable the button I use: $mainTB->SetButtonState($butnum,0); Hope that is of some help... Cheers, jez. |