Hi Aldo

I tried this (your example) but my question is - how do I provide such an
event? My sub Graphic_Paint is never called.

Grendi

========================================
urs grendelmeier
heuweg 21
ch-5734 reinach

+41 (79) 507 68 56 ([EMAIL PROTECTED])
========================================


no, you should create a Win32::GUI::Graphic object and then provide
a Paint() event for it. Example:

    $Window->AddGraphic(
        -name => "Graphic",
        -pos  => [ 0, 0 ],
        -size => [ $Window->ScaleWidth, $Window->ScaleHeight ],
    );

    sub Graphic_Paint {
        my($DC) = @_;
        my $grey  = new Win32::GUI::Pen(
            -color => [ 128, 128, 128 ]
        );
        my $white = new Win32::GUI::Pen(
            -color => [ 255, 255, 255 ]
        );
        $DC->SelectObject($grey);
        $DC->MoveTo(0, 5);
        $DC->LineTo(200, 5);
        $DC->SelectObject($white);
        $DC->MoveTo(0, 7);
        $DC->LineTo(200, 7);
        $DC->Validate();
    }

as you can see from the example, the way to draw in colors is to create
the pen objects you need and select them before drawing; remember to
Validate the Device Context before leaving the Paint() event or your
window will flicker badly :-)

cheers,
Aldo


Reply via email to