vb中picture用line画两闭合图形的时候中间多了一条线?运行代码,调用两个数组,画出图形不一定是矩形,可能是其他形状.For I = 0 To UBound(X,2) - 1 x1 = X(0,I) * (f - 100) / (b + d) y1 = X(1,I) * (f - 1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 07:04:55
vb中picture用line画两闭合图形的时候中间多了一条线?运行代码,调用两个数组,画出图形不一定是矩形,可能是其他形状.For I = 0 To UBound(X,2) - 1 x1 = X(0,I) * (f - 100) / (b + d) y1 = X(1,I) * (f - 1
vb中picture用line画两闭合图形的时候中间多了一条线?
运行代码,调用两个数组,画出图形不一定是矩形,可能是其他形状.
For I = 0 To UBound(X,2) - 1
x1 = X(0,I) * (f - 100) / (b + d)
y1 = X(1,I) * (f - 100) / (c + e)
x2 = X(0,I + 1) * (f - 100) / (b + d)
y2 = X(1,I + 1) * (f - 100) / (c + e)
Picture1.Line (x1,y1)-(x2,y2),vbRed
Next I
Picture1.Refresh
DoEvents
Do While U < UBound(z,2)
x3 = z(0,U) * (f - 100) / (b + d)
y3 = z(1,U) * (f - 100) / (c + e)
x4 = z(0,U + 1) * (f - 100) / (b + d)
y4 = z(1,U + 1) * (f - 100) / (c + e)
Picture1.Line (x3,y3)-(x4,y4),vbBlue
U = U + 1
Loop
vb中picture用line画两闭合图形的时候中间多了一条线?运行代码,调用两个数组,画出图形不一定是矩形,可能是其他形状.For I = 0 To UBound(X,2) - 1 x1 = X(0,I) * (f - 100) / (b + d) y1 = X(1,I) * (f - 1
如果你想画出闭合的图形,数组里存储的点,必须是闭合的,即最后一个点跟第一个点一样,不知道你b,c,d,e,f参数都是什么值,没法运行试试.不过中间的线没有道理
Option Explicit
Private Sub Command1_Click()
Dim z() As Integer
Dim U As Integer, f As Integer, b As Integer, c As Integer, d As Integer, e As Integer
Dim x3 As Integer, y3 As Integer, x4 As Integer, y4 As Integer
ReDim z(1, 4)
f = Picture1.Width
b = 1
c = 1
d = 1
e = 1
z(0, 0) = 0
z(1, 0) = 0
z(0, 1) = 1
z(1, 1) = 0
z(0, 2) = 1
z(1, 2) = 1
z(0, 3) = 0
z(1, 3) = 1
z(0, 4) = 0
z(1, 4) = 0
U = 0
Do While U < UBound(z, 2)
x3 = z(0, U) * (f - 100) / (b + d)
y3 = z(1, U) * (f - 100) / (c + e)
x4 = z(0, U + 1) * (f - 100) / (b + d)
y4 = z(1, U + 1) * (f - 100) / (c + e)
Picture1.Line (x3, y3)-(x4, y4), vbBlue
U = U + 1
Loop
End Sub
效果图