Hi, I am trying to draw an interactive graph in a window, and I don't want to use GD, ImageMagick, Freeimage or any other libraries because of portability issues. However, I can't figure out how to correctly use Win32::GUI::Graphic, Win32::GUI::DC, WM_Paint and InvalidateRect. I've tried reading through some of my MSDN docs that came with my copy of VC++ 6.0, but I couldn't figure this out. I also looked through the samples directory in the Win32::GUI distribution, but none of them use the Graphic object or _Paint handlers.
Can _Paint messages be generated only for Win32::GUI::Graphic objects? How do I tell my program to redraw a window object? What will cause a window object to be redrawn? Does the entire window object have to be redrawn or can an area of specified coordinates within the window object be redrawn? What are the options that can be set in a "new Win32::GUI::Graphic"? I cannot find them in GUI.xs. Can someone share a simple, working example of the usage of Win32::GUI::Graphic, WM_Paint, and InvalidateRect so that I can get started on experimentation? Thanks in advance, Rod Here is my code so far: #!c:/Perl/bin/wperl.exe -w use strict; use Win32::GUI; my $topwin = new Win32::GUI::Window( -name => 'topwin', -title => 'window', -width => 800, -height => 600, -pos => [125,75], -maximizebox => "0", -minimizebox => "0", -resizable => "0" ); my $graph = new Win32::GUI::Graphic( $topwin, -name => "graph" ); $topwin->Show(); $topwin->graph->InvalidateRect(1); Win32::GUI::Dialog(); sub topwin_Terminate { return -1; } sub graph_Paint { my $W = $topwin->ScaleWidth; my $H = $topwin->ScaleHeight; my $DC = $topwin->graph->GetDC; my $P = new Win32::GUI::Pen( -color => 'BLACK', -width => 1, ); $DC->SelectObject($P); $DC->BeginPath(); $DC->MoveTo(50,50); $DC->LineTo(45,75); $DC->EndPath(); $DC->StrokePath(); $DC->Validate; } exit; ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.