Wednesday, April 29, 2009

Function ARC

'Function Arc

Private Declare Function Arc
Lib "gdi32" (ByVal
hdc As Long, _

ByVal X1 As Long,
ByVal Y1 As Long,
ByVal X2 As Long
_

ByVal Y2 As Long,
ByVal X3 As Long,
ByVal Y3 As Long
_

ByVal X4 As Long,
ByVal Y4 As Long)
As Long



Private Sub Form_Load()

    'Set graphical mode to persistent

    Me.AutoRedraw = True

    'Draw to arcs

    Arc Me.hdc, 0, 0, 100, 100, 100, 50, 50, 100

    Arc Me.hdc, 49, 49, 149, 149, 49, 99, 99, 49

End Sub



'Function Arc To

Const AD_CLOCKWISE = 2

Const AD_COUNTERCLOCKWISE = 1



Private Declare Function ArcTo
Lib "gdi32" (ByVal hdc
As Long, _

ByVal X1 As Long,
ByVal Y1 As Long,
ByVal X2 As Long, _

ByVal Y2 As Long,
ByVal X3 As Long,
ByVal Y3 As Long, _

ByVal X4 As Long,
ByVal Y4 As Long)
As Long

Private Declare Function SetArcDirection Lib
"gdi32" _

(ByVal hdc As Long, ByVal ArcDirection
As Long) As Long

Private Declare Function GetArcDirection Lib
"gdi32" _

(ByVal hdc As Long) As Long



Private Sub Form_Paint()

    If GetArcDirection(Me.hdc) =
AD_CLOCKWISE Then

    SetArcDirection Me.hdc, AD_COUNTERCLOCKWISE

    End If

    ArcTo Me.hdc, 20, 20, 50, 60, 50, 60, 20, 60

End Sub







 

No comments:

Post a Comment