-----Original Message-----
From: David Hiltz <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: luned́ 1 marzo 1999 22.39
Subject: [perl-win32-gui] Background color of rectangle



David Hiltz wrote:
>  I'm trying to draw a rectangle in a window using Win32::GUI::DC and
>  I can't seem to get the background color of the rectangle to be the
>  same as the background color of the window.  The background color
>  of the rectangle comes out white.
>
>  Here's my code to draw a button on a window and put a red rectangle
around
>  the button.  The background color of the rectangle is white instead of
>  gray.  I played with BackColor and BkMode but it didn't seem to help.


the Rectangle() function draws a rectangle using the current pen for the
border and the current brush, which seems to be white by default, for the
inside.
you have to create a brush loading the system defined NULL_BRUSH, eg.
same as the window background.

    $P = new Win32::GUI::Pen(
        -color => [150,0,0],
        -width => 1,
    );

    $NULL_BRUSH = 5;
    $B = Win32::GUI::GetStockObject($NULL_BRUSH);

    $DC->SelectObject($P);
    $DC->SelectObject($B);
    $DC->Rectangle(10,10,66,60);

bye,
Aldo Calpini
<[EMAIL PROTECTED]>




Reply via email to