http://www.vb-helper.com/HowTo/pgnform2.zip

	Purpose
Fit a form to its picture and cut off a corner of it

	Method
Use the Picture.Width and Picture.Height properties to see how big to make the form. The Picture's dimensions are in HiMetric units so convert them into twips.

Then use the CreatePolygonRgn API function to create a Windows region with the shape you want. Finally use SetWindowRgn to restrict the form to the region.

    Private Sub Form_Load()
    Const ALTERNATE = 1
    
    Dim rgn As Long
    Dim wid As Single
    Dim hgt As Single
    Dim points(1 To 5) As POINTAPI
    
        ' Fit the form to the picture.
        wid = ScaleX(Picture.Width, vbHimetric, vbTwips)
        hgt = ScaleY(Picture.Height, vbHimetric, vbTwips)
        Width = wid
        Height = hgt
    
        ' Create the points for the polygon.
        wid = ScaleX(wid, vbTwips, vbPixels)
        hgt = ScaleY(hgt, vbTwips, vbPixels)
        points(1).X = 0
        points(1).Y = 0
        points(2).X = wid
        points(2).Y = 0
        points(3).X = wid
        points(3).Y = hgt * 0.8
        points(4).X = wid * 0.8
        points(4).Y = hgt
        points(5).X = 0
        points(5).Y = hgt
    
        ' Create the region.
        rgn = CreatePolygonRgn(points(1), 5, ALTERNATE)
    
        ' Restrict the window to the region.
        SetWindowRgn hWnd, rgn, True
    End Sub


	Disclaimer
This example program is provided "as is" with no warranty of any kind. It is
intended for demonstration purposes only. In particular, it does no error
handling. You can use the example in any form, but please mention
www.vb-helper.com.
