关于vb polyline画线,下面程序运行后为什么不会把已有十点连接呢?求高手指教。
Dimbpoints()AsPOINTAPIPrivateDeclareFunctionPolylineLib"gdi32"(ByValhdcAsLong,lpPoint...
Dim bpoints() As POINTAPI
Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub draw_line()
DrawWidth = 5
Polyline Form1.hdc, bpoints(0), pointcount
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static pointnum As Integer
Debug.Print pointnum
Const pointcount = 10
ReDim Preserve bpoints(pointnum) As POINTAPI
bpoints(pointnum).X = X
bpoints(pointnum).Y = Y
DrawWidth = 3
PSet (X, Y)
pointnum = pointnum + 1
If pointnum = pointcount Then
Call draw_line
pointnum = 0
End If
End Sub 展开
Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub draw_line()
DrawWidth = 5
Polyline Form1.hdc, bpoints(0), pointcount
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static pointnum As Integer
Debug.Print pointnum
Const pointcount = 10
ReDim Preserve bpoints(pointnum) As POINTAPI
bpoints(pointnum).X = X
bpoints(pointnum).Y = Y
DrawWidth = 3
PSet (X, Y)
pointnum = pointnum + 1
If pointnum = pointcount Then
Call draw_line
pointnum = 0
End If
End Sub 展开
1个回答
2012-11-29
展开全部
Dim bpoints() As POINTAPI
Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub draw_line(pointcount1)
DrawWidth = 5
Polyline Form1.hdc, bpoints(0), pointcount1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static pointnum As Integer
Debug.Print pointnumConst
pointcount = 10
ReDim Preserve bpoints(pointnum) As POINTAPI
bpoints(pointnum).X = X / 15
bpoints(pointnum).Y = Y / 15
DrawWidth = 3
PSet (X, Y)
pointnum = pointnum + 1
If pointnum = pointcount Then
Call draw_line(pointcount)
pointnum = 0
End If
End Sub
Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub draw_line(pointcount1)
DrawWidth = 5
Polyline Form1.hdc, bpoints(0), pointcount1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static pointnum As Integer
Debug.Print pointnumConst
pointcount = 10
ReDim Preserve bpoints(pointnum) As POINTAPI
bpoints(pointnum).X = X / 15
bpoints(pointnum).Y = Y / 15
DrawWidth = 3
PSet (X, Y)
pointnum = pointnum + 1
If pointnum = pointcount Then
Call draw_line(pointcount)
pointnum = 0
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询