Hi,

I'm not sure what you example code actually does:)? If I comment out all the code for SetLayeredWindowAttributes there is no change to the window? 

You'll probably want to set the background of the button to the same color as the window as any app with windows XP styles set will use rounded buttons.

To answer your questions, you shouldn't have any issue displaying bitmaps with transparancy, it's just a case of converting it to the correct object (I use icon's with 24 or 32 bit color). In most cases WS_CLIPCHILDREN will remove flicker on resize, but there is also a -noflicker option that works in some cases (it uses double buffering). Flicker free child windows with scroll bars are no problem as WS_CLIPCHILDREN will solve the flicker issue.   

Regards,

jez.


Date: Tue, 19 Oct 2010 23:44:55 -0600
From: rob.johansen@gmail.com
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Robust Windows

Hi all,

I'm trying to come up with the best approach for creating aesthetically pleasing windows that:

- Have labels whose bitmap has transparency (.png files loaded by DIBitmap)
- Don't exhibit any flicker
- Are layered windows (this seems to improve quality during animation/transparency)
- Support child windows that can be scrolled and don't flicker

Below is the code I've come up with so far (without bitmap labels). Is there anything else I should consider? Could I be doing something better?


########## CODE BEGIN

use strict;
use Win32::GUI qw(WS_CLIPCHILDREN);
use Win32::API;

use constant WS_EX_LAYERED => 0x00080000;
use constant LWA_COLORKEY  => 0x00000001;
use constant LWA_ALPHA     => 0x00000002;
use constant GWL_EXSTYLE   => -20;

my $main = 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 = $main->GetWindowLong(GWL_EXSTYLE);
$winstyle = $winstyle | WS_EX_LAYERED;
$main->SetWindowLong(GWL_EXSTYLE, $winstyle || WS_EX_LAYERED);
$setLayeredWindowAttributes->Call($main->{-handle}, 0, 255, LWA_ALPHA);

my $OK = $main->AddButton
(
    -name => 'OK',
    -text => 'OK',
    -size => [80,25],
    -pos  => [10,10],
);

$main->Center();
$main->Show();
Win32::GUI::Dialog();

########## CODE END


Thanks,
Rob

------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-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/