VB中:Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) 请问40 Private Sub Command2_Click()Dim x1 As DoubleDim x2 As DoubleDim y1 As DoubleDim y2 As DoubleDim d1 As DoubleDim dx As DoubleDim dy As DoubleDim f As Double '定义变

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 16:57:33
VB中:Picture1.Line(40*x1/e,40*y1/e)-(40*x2/e,40*y2/e)请问40PrivateSubCommand2_Click()Dimx1AsDoubleDimx2

VB中:Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) 请问40 Private Sub Command2_Click()Dim x1 As DoubleDim x2 As DoubleDim y1 As DoubleDim y2 As DoubleDim d1 As DoubleDim dx As DoubleDim dy As DoubleDim f As Double '定义变
VB中:Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) 请问40
Private Sub Command2_Click()
Dim x1 As Double
Dim x2 As Double
Dim y1 As Double
Dim y2 As Double
Dim d1 As Double
Dim dx As Double
Dim dy As Double
Dim f As Double '定义变量
Dim X As Double
Dim Y As Double
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As Double
Dim e As Double
Dim n As Integer
x1 = Text1.Text '起点终点坐标赋值
y1 = Text2.Text
x2 = Text3.Text
y2 = Text4.Text
d1 = Text5.Text
X = x1
Y = y1
f = (x2 - x1) * (Y - y1) - (y2 - y1) * (X - x1) '偏差函数
If x2 >= x1 Then
dx = d1
a = x2
b = x1
If y2 >= y1 Then
dy = d1
c = y2
d = y1
Else:dy = -d1
c = y1
d = y2
End If
Else:dx = -d1
a = x1
b = x2
If y2 >= y1 Then
dy = d1
c = y2
d = y1
Else:dy = -d1
c = y1
d = y2
End If
End If
If a > c Then
e = a
Else:e = c
End If
Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) '画直线
Do While n < (a - b + c - d) / d1 ' 终点计数器,终点判断
If (x2 - x1) * (y2 - y1) > 0 Then '第一象限
If f >= 0 Then
Picture1.Line (40 * X / e,40 * Y / e)-(40 * (X + dx) / e,40 * Y / e)
X = X + dx
n = n + 1
Else
Picture1.Line (40 * X / e,40 * Y / e)-(40 * X / e,40 * (Y + dy) / e)
Y = Y + dy
n = n + 1
End If
f = (x2 - x1) * (Y - y1) - (y2 - y1) * (X - x1)
Else
If f >= 0 Then
Picture1.Line (40 * X / e,40 * Y / e)-(40 * X / e,40 * (Y + dy) / e)
Y = Y + dy
n = n + 1
Else
Picture1.Line (40 * X / e,40 * Y / e)-(40 * (X + dx) / e,40 * Y / e)
X = X + dx
n = n + 1
End If
f = (x2 - x1) * (Y - y1) - (y2 - y1) * (X - x1)
End If
Loop
End Sub
这是我课设用的一段程序,没学过vb,
Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) 中的40怎么来的,

VB中:Picture1.Line (40 * x1 / e,40 * y1 / e)-(40 * x2 / e,40 * y2 / e) 请问40 Private Sub Command2_Click()Dim x1 As DoubleDim x2 As DoubleDim y1 As DoubleDim y2 As DoubleDim d1 As DoubleDim dx As DoubleDim dy As DoubleDim f As Double '定义变
你这个程序是用来干嘛的?
应该就是一个随便给定的值 可以改成50或者60 没什么影响
就是起一个放大的作用吧
你可以把运行一下把数据改一下再运行一下 应该没有影响