Thanks for the reply, but could you please give me some more info on this. I
have tried using

  SetWindowRgn(Canvas.Handle, CreatePolygonRgn(FPoly, 4, WINDING), False);

but it hasn't solved the problem. Whenever the dimensions/position of the
TRotateButton are changed, I calculate the new FPoly coordinates and adjust
the control's Top, Left, Width & Height so that the polygon can be
completely contained within the overall control window. Then I make the
SetWindowRegion call followed by Refresh.

Any ideas what I'm doing wrong? 

Tom

> -----Original Message-----
> From: Chris Crowe [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 20, 1999 11:54 PM
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: How to draw a non-rectangular control?
> 
> 
> I would have a look at the code to create custom window 
> shapes, basically
> you just use a region.
> 
> int SetWindowRgn(
> 
>     HWND hWnd,        // handle to window whose window region 
> is to be set
>     HRGN hRgn,        // handle to region
>     BOOL bRedraw      // window redraw flag
>    );
> 
> The SetWindowRgn function sets the window region of a window. 
> The window
> region determines the area within the window where the 
> operating system
> permits drawing. The operating system does not display any 
> portion of a
> window that lies outside of the window region
> 
> Chris
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Tom Munro Glass
> Sent: Tuesday, July 20, 1999 9:37 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: How to draw a non-rectangular control?
> 
> 
> I'm trying to develop a button-like control which can be 
> rotated, and I need
> to be able to stack a number of these controls next to each 
> other like a
> sort of rotated toolbar.
> 
> The Paint method uses Canvas.Polygon to draw the rotated 
> rectangular button,
> but the overall control window is being erased and is 
> overwriting adjacent
> controls. How can I draw this non-rectangular control without touching
> anything outside the area of my polygon?
> 
> TRotateButton is derived from TCustomControl.
> 
> Thanks in advance.
> 
> ==================================================================
> 
> Tom Munro Glass
> 
> +----------------------------------------------------------------+
> | E-mail:                                                        |
> |     Internet:           [EMAIL PROTECTED]                         |
> | Web sites:                                                     |
> |     TMG CONSULTANCY:    http://www.tmgcon.com                  |
> |     Tewkesbury Web:     http://www.tmgcon.com/tewksweb         |
> +----------------------------------------------------------------+
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to