关于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
展开
 我来答
匿名用户
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
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式