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
偶就补充一下用 API 画的圆弧吧
===========================
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
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
Dim CX, CY, Radius, Limit ' Declare variable.
ScaleMode = 3 ' Set scale to pixels.
CX = ScaleWidth / 2 ' Set X position.
CY = ScaleHeight / 2 ' Set Y position.
If CX > CY Then Limit = CY Else Limit = CX
For Radius = 0 To Limit ' Set radius.
Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next Radius
End Sub