vb line 画不了直线问题?
PrivateSubPicture1_Click()DimnAsIntegern=InputBox("输入n的值")Picture1.PrintTab(5);"递归n="...
Private Sub Picture1_Click()
Dim n As Integer
n = InputBox("输入n的值")
Picture1.Print Tab(5); "递归 n=" & Str(n) & " 时的图形"
Picture1.Scale (0, 600)-(600, 0)
Call triangle(30, 320, 570, 30, 570, n)
End Sub
Public Sub triangle(x1!, x2!, x3!, y1!, y2!, k%)
Dim u1!, u2!, v1!, v2!
If k > 1 Then
u1 = (x1 + x2) / 2
u2 = (x2 + x3) / 2
v1 = (y1 + y2) / 2
Call triangle(u1, x2, u2, v1, y2, k - 1)
Call triangle(x1, u1, x2, y1, v1, k - 1)
Call triangle(x2, u2, x3, y1, v1, k - 1)
Else
Picture.Line (x1, y1)-(x3, y1) '对象不支持的属性或方法,想在图片框内画,怎么修改?
Picture.Line (x1, y1)-(x2, y2)
Picture.Line (x2, y2)-(x3, y1)
End If
End Sub 展开
Dim n As Integer
n = InputBox("输入n的值")
Picture1.Print Tab(5); "递归 n=" & Str(n) & " 时的图形"
Picture1.Scale (0, 600)-(600, 0)
Call triangle(30, 320, 570, 30, 570, n)
End Sub
Public Sub triangle(x1!, x2!, x3!, y1!, y2!, k%)
Dim u1!, u2!, v1!, v2!
If k > 1 Then
u1 = (x1 + x2) / 2
u2 = (x2 + x3) / 2
v1 = (y1 + y2) / 2
Call triangle(u1, x2, u2, v1, y2, k - 1)
Call triangle(x1, u1, x2, y1, v1, k - 1)
Call triangle(x2, u2, x3, y1, v1, k - 1)
Else
Picture.Line (x1, y1)-(x3, y1) '对象不支持的属性或方法,想在图片框内画,怎么修改?
Picture.Line (x1, y1)-(x2, y2)
Picture.Line (x2, y2)-(x3, y1)
End If
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询