AllApi.net

[an error occurred while processing this directive]
 
Private Declare Function GetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function IntersectClipRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function OffsetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Dim hRgn As Long
Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Paint()
    Form_Resize
End Sub
Private Sub Form_Resize()
    Dim Ret As Long
    'destroy the previous region
    DeleteObject hRgn
    'create an elliptic region
    hRgn = CreateEllipticRgn(0, 0, Me.ScaleWidth, Me.ScaleHeight)
    'select this elliptic region into the form's device context
    SelectClipRgn Me.hdc, hRgn
    'move the clipping region
    OffsetClipRgn Me.hdc, 10, 10
    'generate a new clipping region
    IntersectClipRect Me.hdc, 10, 10, 500, 300
    'clear the form
    Me.Cls
    'draw a Black rectangle over the entire form
    Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbBlack, BF
    'create a temporary region
    Ret = CreateEllipticRgn(0, 0, 1, 1)
    'copy the current clipping region into the temporary region
    GetClipRgn Me.hdc, Ret
    'set the new window region
    SetWindowRgn Me.hWnd, Ret, True
End Sub
Private Sub Form_Unload(Cancel As Integer)
    'clean up
    DeleteObject hRgn
End Sub
Private Sub Form_Click()
    'unload the form when the user clicks on it
    Unload Me
End Sub


 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/