Thanks for the response. One
more quick question that I know has been asked before but never been
answered correctly (AFAIK): Is it possible to create a transparent
label? Or perhaps a better question: Is it possible to overlap two
transparent images such that the transparence of the top image allows
the bottom image to still be visible? I've found that the transparency of bitmaps (icons/pngs) only seems to work on the parent window. In other words if I have one png overlapping another, the second png isn't fully visible even if the only thing covering it is the transparency of the first png. Here's some example code (you can download the "blocks.png" file from my server (http://www.robjohansen.com/blocks.png)): ##### CODE BEGIN use strict; use Win32::GUI qw(WS_BORDER WS_CAPTION WS_CHILD WS_CLIPCHILDREN WS_CLIPSIBLINGS WS_SIZEBOX WS_THICKFRAME); use Win32::API; use Win32::GUI::DIBitmap; use constant WS_EX_LAYERED => 0x00080000; use constant LWA_COLORKEY => 0x00000001; use constant LWA_ALPHA => 0x00000002; use constant GWL_EXSTYLE => -20; my $mainWindow = Win32::GUI::Window->new ( -background ="" [153,0,0], -pushstyle => WS_CLIPCHILDREN, -text => 'Test', -size => [500,500], ); my $setLayeredWindowAttributes = Win32::API->new('user32', 'SetLayeredWindowAttributes', 'LLIN', 'I'); my $winstyle = $mainWindow->GetWindowLong(GWL_EXSTYLE); $winstyle = $winstyle | WS_EX_LAYERED; $mainWindow->SetWindowLong(GWL_EXSTYLE, $winstyle || WS_EX_LAYERED); $setLayeredWindowAttributes->Call($mainWindow->{-handle}, 0, 255, LWA_ALPHA); my $transparentImage = $mainWindow->AddLabel ( -background ="" [153,0,0], -bitmap => Win32::GUI::DIBitmap->newFromFile('blocks.png')->ConvertToBitmap(), -pos => [80,80], -size => [128,128], ); my $transparentImage2 = $mainWindow->AddLabel ( -background ="" [153,0,0], -bitmap => Win32::GUI::DIBitmap->newFromFile('blocks.png')->ConvertToBitmap(), -pos => [180,180], -size => [128,128], ); my $OK = $mainWindow->AddButton ( -background ="" [153,0,0], -name => 'OK', -text => 'OK', -size => [80,25], -pos => [10,10], ); $mainWindow->Center(); $mainWindow->Show(); Win32::GUI::Dialog(); sub OK_Click { Win32::GUI::Change($mainWindow => -background ="" [0,0,153]); Win32::GUI::Change($transparentImage => -background ="" [0,0,153]); Win32::GUI::Change($transparentImage2 => -background ="" [0,0,153]); Win32::GUI::Change($OK => -background ="" [0,0,153]); $mainWindow->InvalidateRect(1); $transparentImage->InvalidateRect(1); $transparentImage2->InvalidateRect(1); $OK->InvalidateRect(1); } ##### CODE END Jeremy White wrote:
|
------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/