有两个API函数与贝塞尔曲线有关
PolyBezier和PolyBezierTo下面的类似例子不知对你有没有帮助
Private Type POINTAPI
X As Long
Y As Long
End TypePrivate Declare Function PolyBezier Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As LongPrivate Declare Function PolyBezierTo Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cCount As Long) As LongDim Flag1 As Boolean
Dim Flag2 As Boolean
Dim Pos(10) As POINTAPI
Dim i As IntegerPrivate Sub Command1_Click() '开始用PolyBezier函数绘图
Flag1 = True
Flag2 = False
End SubPrivate Sub Command2_Click()
Flag1 = False
Flag2 = True
End SubPrivate Sub Command3_Click()
Flag1 = False
Flag2 = False
End SubPrivate Sub Command4_Click()
Me.Picture1.Cls
End SubPrivate Sub Form_Load()
Flag1 = False
Flag2 = False
Me.ScaleMode = 3
Me.Picture1.ScaleMode = 3
i = 0
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Flag1 Then
Pos(i).X = X
Pos(i).Y = Y
If (i >= 3) Then
PolyBezier Me.Picture1.hdc, Pos(0), 4
Me.Picture1.Circle (X, Y), 3
i = 0
Exit Sub
End If
If (i <= 3) Then
i = i + 1
Me.Picture1.Circle (X, Y), 3
End If
End If
If Flag2 Then
Pos(i).X = X
Pos(i).Y = Y
If (i >= 3) Then
PolyBezierTo Me.Picture1.hdc, Pos(0), 3
Me.Picture1.Circle (X, Y), 3
i = 0
Exit Sub
End If
End If
If (i <= 3) Then
i = i + 1
Me.Picture1.Circle (X, Y), 3
End If
End Sub
PolyBezier和PolyBezierTo下面的类似例子不知对你有没有帮助
Private Type POINTAPI
X As Long
Y As Long
End TypePrivate Declare Function PolyBezier Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cPoints As Long) As LongPrivate Declare Function PolyBezierTo Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cCount As Long) As LongDim Flag1 As Boolean
Dim Flag2 As Boolean
Dim Pos(10) As POINTAPI
Dim i As IntegerPrivate Sub Command1_Click() '开始用PolyBezier函数绘图
Flag1 = True
Flag2 = False
End SubPrivate Sub Command2_Click()
Flag1 = False
Flag2 = True
End SubPrivate Sub Command3_Click()
Flag1 = False
Flag2 = False
End SubPrivate Sub Command4_Click()
Me.Picture1.Cls
End SubPrivate Sub Form_Load()
Flag1 = False
Flag2 = False
Me.ScaleMode = 3
Me.Picture1.ScaleMode = 3
i = 0
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Flag1 Then
Pos(i).X = X
Pos(i).Y = Y
If (i >= 3) Then
PolyBezier Me.Picture1.hdc, Pos(0), 4
Me.Picture1.Circle (X, Y), 3
i = 0
Exit Sub
End If
If (i <= 3) Then
i = i + 1
Me.Picture1.Circle (X, Y), 3
End If
End If
If Flag2 Then
Pos(i).X = X
Pos(i).Y = Y
If (i >= 3) Then
PolyBezierTo Me.Picture1.hdc, Pos(0), 3
Me.Picture1.Circle (X, Y), 3
i = 0
Exit Sub
End If
End If
If (i <= 3) Then
i = i + 1
Me.Picture1.Circle (X, Y), 3
End If
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货