From: Soren H. <sor...@gm...> - 2013-04-01 09:24:51
|
Hello, I'm drawing stuff in a window, then minimizing the window to the bottom part of the screen using the Windows underscore symbol. When my mouse hovers over the minimized icon, the content is still there. When I click on the icon to reopen the window, the content is gone. Simple example included below, where the top half of the window is painted green, the bottom part red. I assume it's some magic to do with dc, onEvent, save, restore etc., but I can't figure it out. In case my setup matters: Windows 7 SP1 CYGWIN_NT-6.1-WOW64 1.7.17(0.262/5/3) 2012-10-19 14:39 perl 5.14 Win32::GUI v1.06 (GUI.pm 1.69) Thanks, Soren #!perl use strict; use warnings; use Win32::GUI(); my $WIDTH = 400; my $HEIGHT = 600; my $win = Win32::GUI::Window->new( -name => 'win', -width => $WIDTH, -height => $HEIGHT ); $win->Show(); &make_example(); Win32::GUI::Dialog(); exit; sub make_example { my $dc = $win->GetDC; my $brush = new Win32::GUI::Brush( [32, 128, 32] ); my $old_brush = $dc->SelectObject($brush); $dc->Rectangle(0, 0, $WIDTH, $HEIGHT/2); $brush = new Win32::GUI::Brush( [178, 63, 63] ); $dc->SelectObject($brush); $dc->Rectangle(0, $HEIGHT/2, $WIDTH, $HEIGHT); $dc->SelectObject($old_brush) if defined ($old_brush); } sub win_Terminate { -1; } |