AllApi.net

[an error occurred while processing this directive]
 
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function PtInRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function PtInRegion Lib "gdi32" (ByVal hRgn As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function CreateEllipticRgnIndirect Lib "gdi32" (lpRect As RECT) As Long
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim mRGN As Long, R As RECT, x As Long, y As Long
    'Set the graphical mode to persistent
    Me.AutoRedraw = True
    'Set the rectangle's values
    SetRect R, 0, 0, 50, 50
    'Create an elliptical region
    mRGN = CreateEllipticRgnIndirect(R)
    For x = R.Left To R.Right
        For y = R.Top To R.Bottom
            'If the point is in the region, draw a green pixel
            If PtInRegion(mRGN, x, y) <> 0 Then
                'Draw a green pixel
                SetPixelV Me.hdc, x, y, vbGreen
            ElseIf PtInRect(R, x, y) <> 0 Then
                'Draw a red pixel
                SetPixelV Me.hdc, x, y, vbRed
            End If
        Next y
    Next x
    'delete our region
    DeleteObject mRGN
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/