VB编程怎么自动读入数据,下面这个程序怎么读,联系我QQ1104427703私聊
Dim Cnstring, FileName As StringDim strSQL As String
Dim Max_radius, Max_lateral, Max_acceleration As Double
Dim Tl, Tn, PictureD As Single
Dim Max_i, Max_j, Interval_i, Interval_len, Interval_high, Interval_grade, Interval_radius As Single
Dim X, CX, Picture_Height, Picture_Height_temp As Long
Dim Y, CY, Picture_Width As Long
Dim Max_xpeg, Min_xpeg As Single
Public cn As ADODB.Connection
Public rs1 As ADODB.Recordset
Private Sub Command1_Click()
Call open_dmb_menu_Click
End Sub
Private Sub Command2_Click()
加载新的数据库.Show
End Sub
Private Sub Command4_Click()
Call StartDraw_menu_Click
End Sub
Private Sub Command5_Click()
Call Save_piture_menu_Click
End Sub
Private Sub Command6_Click()
Call opt_menu_Click
End Sub
Private Sub Form_Load()
FileName = ""
TexturesLen = 0
RecLength = 0
PictureD = 0
i = 0
j = 0
Tn = 0
Max_radius = 0
Max_lateral = 0
Max_acceleration = 0
'Max_defletion = 0
'Max_track = 0
'Max_accident = 0
'Max_maxlateral = 0
Opt_form横向力系数.Text3.Text = str(Picture1.Width)
Opt_form横向力系数.Text4.Text = str(Picture1.Height)
Picture_Height = Picture1.Height
Picture_Width = Picture1.Width
CX = 100
CY = 100
Load Opt_form横向力系数
End Sub
Private Sub exit_menu_Click()
Unload Me
End Sub
Private Sub Load_newdata_menu_Click()
加载新的数据库.Show
End Sub
Private Sub Picture1_Click()
CommonDialog3.ShowColor
Picture1.BackColor = CommonDialog3.color
End Sub
Private Sub VScroll1_Change()
Picture1.Top = -30 * VScroll1.Value
End Sub
Private Sub HScroll2_Change()
Picture1.Left = -30 * HScroll2.Value
End Sub
'打开数据库
Private Sub open_dmb_menu_Click()
CommonDialog1.Filter = "Access数据库文件(*.mdb)|*.mdb|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName
If FileName = "" Then
Exit Sub
End If
Cnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & FileName
Set cn = New ADODB.Connection
cn.ConnectionString = Cnstring
cn.Open
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select max(abs(半径)) as max_r,max(abs(1/半径)) as max_p,max(abs(直线长度)) as max_l,max(abs(坡度)) as max_g,max(abs(形式桩号)) as max_xpeg ,min(abs(形式桩号)) as min_xpeg from 道路上行特征数据 "
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
If rs1.EOF Then
Exit Sub
Else
Max_xpeg = rs1.Fields("max_xpeg")
Min_xpeg = rs1.Fields("min_xpeg")
End If
rs1.Close
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select max(半径) as max_r from 横向力参数表 "
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
If rs1.EOF Then
Exit Sub
Else
Max_radius = rs1.Fields("max_r")
End If
rs1.Close
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select max(汽车侧向加速度) as max_l from 横向力参数表 "
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
If rs1.EOF Then
Exit Sub
Else
Max_lateral = rs1.Fields("max_l")
End If
rs1.Close
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select max(设计车速横向力系数) as max_al from 横向力参数表 "
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
If rs1.EOF Then
Exit Sub
Else
Max_acceleration = rs1.Fields("max_al")
End If
rs1.Close
PictureD = 0
If Opt_form横向力系数.Check1.Value Then PictureD = PictureD + 1
If Opt_form横向力系数.Check2.Value Then PictureD = PictureD + 1
If Opt_form横向力系数.Check3.Value Then PictureD = PictureD + 1
If Picture_Height = 0 Then Picture_Height = 6795
Max_ratio = 0
If Max_ratio < Max_radius Then Max_ratio = Max_radius
If Max_ratio < Max_lateral Then Max_ratio = Max_lateral
If Max_ratio < Max_acceleration Then Max_ratio = Max_acceleration
Max_ratio = Max_ratio * 0.7
If Opt_form横向力系数.Option1.Value = True Then
Interval_r = (Max_ratio * 200) / (Picture_Height - 200) * 5
'interval_l = (Max_ratio * 200) / (Picture_Height - 200) * 5
'Interval_a = (Max_ratio * 200) / (Picture_Height - 200) * 5
Opt_form横向力系数.Text2(0).Text = 1000
Opt_form横向力系数.Text2(1).Text = 0.2
Opt_form横向力系数.Text2(2).Text = 0.05
End If
If Opt_form横向力系数.Option2.Value = True Then
Interval_r = (Max_radius * 200) / Picture_Height * PictureD * 5
Interval_l = Max_lateral / Picture_Height * 200 * 5 * PictureD
interval_al = Max_acceleration * 200 * 5 / Picture_Height * PictureD
Opt_form横向力系数.Text2(0).Text = 1000
Opt_form横向力系数.Text2(1).Text = 0.2
Opt_form横向力系数.Text2(2).Text = 0.05
End If
End Sub
Private Sub opt_menu_Click()
Opt_form横向力系数.Show
End Sub
Private Sub Save_piture_menu_Click()
CommonDialog2.DefaultExt = "bmp"
CommonDialog2.Filter = "图形文件(*.bmp)|*.bmp|所有文件(*.*)|*.*"
CommonDialog2.ShowSave
FileName = CommonDialog2.FileName
If FileName = "" Then
Else
SavePicture Picture1.Image, FileName
FileName = ""
End If
End Sub
'画图
Private Sub StartDraw_menu_Click()
Dim str_var, rsstr_Fields1, rsstr_Fields2, rsstr_Fields3, rsstr_Fields4, rsstr_Fields5, rsstr_Fields6 As Double
Dim interval_i_text As String
Picture_Height = Val(Opt_form横向力系数.Text4.Text)
Picture_Width = Val(Opt_form横向力系数.Text3.Text)
If Picture_Height > 6795 Then
VScroll1.Value = (Picture_Height - 6795) / 2 / 30
Else
VScroll1.Value = 0
End If
Picture1.Height = Picture_Height
Picture1.Width = Picture_Width
'开始绘图
If Opt_form横向力系数.Option1.Value = True Then '重叠式绘图
Picture1.Cls
PictureD = 1
Dim CurpictureD, Picture_Height_temp, Max_ratio As Single
Max_ratio = 0
If Max_ratio < Max_radius Then Max_ratio = Max_radius
If Max_ratio < Max_lateral Then Max_ratio = Max_lateral
If Max_ratio < Max_acceleration Then Max_ratio = Max_acceleration
Max_ratio = Max_ratio * 0.0002
dx = (Picture_Width - 200) / (Max_xpeg - Min_xpeg) '(Max_xpeg - Min_xpeg)为道路长度
If Max_ratio = 0 Then Exit Sub
dr_ratio = Picture_Height / Max_ratio
dl_ratio = Picture_Height / Max_ratio
dal_ratio = Picture_Height / Max_ratio
CurpictureD = 0
Picture_Height_temp = 0
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_x_d(Val(Picture_Width), Val(Picture_Height), Val(Opt_form横向力系数.Text1.Text))
If Opt_form横向力系数.Check2.Value Then
CurpictureD = CurpictureD + 1
Picture_Height_temp = Picture_Height * (2 * CurpictureD - 1) / PictureD
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_y_d(Val(Picture_Height), Val(Opt_form横向力系数.Text2(1).Text), Val(Max_ratio), Val(PictureD), Val(CurpictureD))
Picture1.DrawWidth = 2
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select 起始桩号,终止桩号,汽车侧向加速度 from 横向力参数表 order by 序号"
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
Do Until rs1.EOF
rsstr_Fields1 = rs1.Fields("起始桩号")
rsstr_Fields2 = rs1.Fields("终止桩号")
rsstr_Fields3 = rs1.Fields("汽车侧向加速度")
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields1 * dx, (Picture_Height - 200) - rsstr_Fields3 * dl_ratio)-(100 + rsstr_Fields2 * dx, (Picture_Height - 200) - rsstr_Fields3 * dl_ratio), Opt_form横向力系数.Line1(1).BorderColor
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100, (Picture_Height - 200) - 1 * dl_ratio)-((Max_xpeg - Min_xpeg) * dx, (Picture_Height - 200) - 1 * dl_ratio), &H0&
rs1.MoveNext
If rs1.EOF Then Exit Do
rsstr_Fields4 = rs1.Fields("起始桩号")
rsstr_Fields5 = rs1.Fields("终止桩号")
rsstr_Fields6 = rs1.Fields("汽车侧向加速度")
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields2 * dx, (Picture_Height - 200) - rsstr_Fields3 * dl_ratio)-(100 + rsstr_Fields4 * dx, (Picture_Height - 200) - rsstr_Fields6 * dl_ratio), Opt_form横向力系数.Line1(1).BorderColor
Loop
rs1.Close
End If
If Opt_form横向力系数.Check3.Value Then
CurpictureD = CurpictureD + 1
Picture_Height_temp = Picture_Height * (2 * CurpictureD - 1) / PictureD
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_y_d(Val(Picture_Height), Val(Opt_form横向力系数.Text2(2).Text), Val(Max_ratio), Val(PictureD), Val(CurpictureD))
Picture1.DrawWidth = 2
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select 起始桩号,终止桩号,设计车速横向力系数 from 横向力参数表 order by 序号"
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
Do Until rs1.EOF
rsstr_Fields1 = rs1.Fields("起始桩号")
rsstr_Fields2 = rs1.Fields("终止桩号")
rsstr_Fields3 = rs1.Fields("设计车速横向力系数")
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields1 * dx, (Picture_Height - 200) - rsstr_Fields3 * dal_ratio)-(100 + rsstr_Fields2 * dx, (Picture_Height - 200) - rsstr_Fields3 * dal_ratio), Opt_form横向力系数.Line1(2).BorderColor
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100, (Picture_Height - 200) - 1 * dal_ratio)-((Max_xpeg - Min_xpeg) * dx, (Picture_Height - 200) - 1 * dal_ratio), &H0&
Picture1.DrawWidth = 2
rs1.MoveNext
If rs1.EOF Then Exit Do
rsstr_Fields4 = rs1.Fields("起始桩号")
rsstr_Fields5 = rs1.Fields("终止桩号")
rsstr_Fields6 = rs1.Fields("设计车速横向力系数")
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields2 * dx, (Picture_Height - 200) - rsstr_Fields3 * dal_ratio)-(100 + rsstr_Fields4 * dx, (Picture_Height - 200) - rsstr_Fields6 * dal_ratio), Opt_form横向力系数.Line1(2).BorderColor
Loop
rs1.Close
End If
End If
If Opt_form横向力系数.Option2.Value = True Then '分离式绘图
Picture1.Cls
CurpictureD = 0
Picture_Height_temp = 0
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
PictureD = 0
If Opt_form横向力系数.Check1.Value Then PictureD = PictureD + 1
If Opt_form横向力系数.Check2.Value Then PictureD = PictureD + 1
If Opt_form横向力系数.Check3.Value Then PictureD = PictureD + 1
dx = (Picture_Width - 200) / (Max_xpeg - Min_xpeg) '(Max_xpeg - Min_xpeg)道路长度
dr_ratio = Picture_Height / Max_radius / PictureD / 2
dl_ratio = Picture_Height / Max_lateral / PictureD / 2
dal_ratio = Picture_Height / Max_acceleration / PictureD / 2
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_x(Val(Picture_Width), Val(Picture_Height), Val(Opt_form横向力系数.Text1.Text), Val(PictureD))
If Opt_form横向力系数.Check1.Value Then
CurpictureD = CurpictureD + 1
Picture_Height_temp = Picture_Height * (2 * CurpictureD - 1) / PictureD
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_y(Val(Picture_Height), Val(Opt_form横向力系数.Text2(0).Text), Val(Max_radius), Val(PictureD), Val(CurpictureD), "半径")
Picture1.DrawWidth = 2
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select 起始桩号,终止桩号,半径 from 横向力参数表 order by 序号"
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
Do Until rs1.EOF
rsstr_Fields1 = rs1.Fields("起始桩号")
rsstr_Fields2 = rs1.Fields("终止桩号")
rsstr_Fields3 = rs1.Fields("半径")
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields1 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dr_ratio)-(100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dr_ratio), Opt_form横向力系数.Line1(0).BorderColor
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100, Picture_Height_temp / 2 - 1 * dr_ratio)-((Max_xpeg - Min_xpeg) * dx, Picture_Height_temp / 2 - 1 * dr_ratio), &H0&
Picture1.DrawWidth = 2
rs1.MoveNext
If rs1.EOF Then Exit Do
rsstr_Fields4 = rs1.Fields("起始桩号")
rsstr_Fields5 = rs1.Fields("终止桩号")
rsstr_Fields6 = rs1.Fields("半径")
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dr_ratio)-(100 + rsstr_Fields4 * dx, Picture_Height_temp / 2 - rsstr_Fields6 * dr_ratio), Opt_form横向力系数.Line1(0).BorderColor
Loop
rs1.Close
End If
If Opt_form横向力系数.Check2.Value Then
CurpictureD = CurpictureD + 1
Picture_Height_temp = Picture_Height * (2 * CurpictureD - 1) / PictureD
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_y(Val(Picture_Height), Val(Opt_form横向力系数.Text2(1).Text), Val(Max_lateral), Val(PictureD), Val(CurpictureD), "汽车侧向加速度")
Picture1.DrawWidth = 2
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select 起始桩号,终止桩号,汽车侧向加速度 from 横向力参数表 order by 序号"
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
Do Until rs1.EOF
rsstr_Fields1 = rs1.Fields("起始桩号")
rsstr_Fields2 = rs1.Fields("终止桩号")
rsstr_Fields3 = rs1.Fields("汽车侧向加速度")
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields1 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dl_ratio)-(100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dl_ratio), Opt_form横向力系数.Line1(1).BorderColor
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100, Picture_Height_temp / 2 - 1 * dl_ratio)-((Max_xpeg - Min_xpeg) * dx, Picture_Height_temp / 2 - 1 * dl_ratio), &H0&
Picture1.DrawWidth = 2
rs1.MoveNext
If rs1.EOF Then Exit Do
rsstr_Fields4 = rs1.Fields("起始桩号")
rsstr_Fields5 = rs1.Fields("终止桩号")
rsstr_Fields6 = rs1.Fields("汽车侧向加速度")
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dl_ratio)-(100 + rsstr_Fields4 * dx, Picture_Height_temp / 2 - rsstr_Fields6 * dl_ratio), Opt_form横向力系数.Line1(1).BorderColor
Loop
rs1.Close
End If
If Opt_form横向力系数.Check3.Value Then
CurpictureD = CurpictureD + 1
Picture_Height_temp = Picture_Height * (2 * CurpictureD - 1) / PictureD
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Call Draw_y(Val(Picture_Height), Val(Opt_form横向力系数.Text2(2).Text), Val(Max_acceleration), Val(PictureD), Val(CurpictureD), "设计车速横向力系数")
Picture1.DrawWidth = 2
Set rs1 = New ADODB.Recordset
rs1.LockType = adLockOptimistic
rs1.CursorType = adOpenKeyset
strSQL = "select 起始桩号,终止桩号,设计车速横向力系数 from 横向力参数表 order by 序号"
rs1.Source = strSQL
Set rs1.ActiveConnection = cn
rs1.Open
Do Until rs1.EOF
rsstr_Fields1 = rs1.Fields("起始桩号")
rsstr_Fields2 = rs1.Fields("终止桩号")
rsstr_Fields3 = rs1.Fields("设计车速横向力系数")
Picture1.DrawWidth = 2
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields1 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dal_ratio)-(100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dal_ratio), Opt_form横向力系数.Line1(2).BorderColor
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100, Picture_Height_temp / 2 - 1 * dal_ratio)-((Max_xpeg - Min_xpeg) * dx, Picture_Height_temp / 2 - 1 * dal_ratio), &H0&
Picture1.DrawWidth = 2
rs1.MoveNext
If rs1.EOF Then Exit Do
rsstr_Fields4 = rs1.Fields("起始桩号")
rsstr_Fields5 = rs1.Fields("终止桩号")
rsstr_Fields6 = rs1.Fields("设计车速横向力系数")
Picture1.DrawWidth = 1
Picture1.DrawStyle = 0
Picture1.Line (100 + rsstr_Fields2 * dx, Picture_Height_temp / 2 - rsstr_Fields3 * dal_ratio)-(100 + rsstr_Fields4 * dx, Picture_Height_temp / 2 - rsstr_Fields6 * dal_ratio), Opt_form横向力系数.Line1(2).BorderColor
Loop
rs1.Close
End If
End If
End Sub
'画横、纵坐标系
Public Sub Draw_x(Picture_Width As Long, Picture_Height As Long, interval As Single, PictureD As Integer)
'横坐标
Dim interval_n, i, j As Integer
Dim interval_p, picture_z As Single
interval_n = 1
i = 1
j = 1
interval_p = 0
picture_z = 0
Picture1.Cls
For j = 1 To PictureD
picture_z = (2 * j - 1) * ((Picture_Height) / PictureD / 2)
Picture1.Line (100, picture_z)-(Picture_Width, picture_z), RGB(0, 0, 0)
interval_n = Round((Max_xpeg - Min_xpeg) / interval * 5) '(Max_xpeg - Min_xpeg)为道路长度
If interval_n = 0 Then interval_n = 1
interval_p = (Picture_Width - 200) / interval_n
For i = 1 To interval_n
Picture1.Line (100 + i * interval_p, picture_z - 40)-(100 + i * interval_p, picture_z)
Next i
For i = 1 To interval_n / 5
Picture1.Line (100 + i * 5 * interval_p, picture_z - 100)-(100 + i * 5 * interval_p, picture_z)
Picture1.CurrentX = Picture1.CurrentX - 300
Picture1.CurrentY = Picture1.CurrentY + 30
Picture1.Print Round(i * interval + Min_xpeg)
Next i
Next j
End Sub
Public Sub Draw_y(Picture_Height As Long, interval As Single, max_value As Double, PictureD As Integer, CurrentD As Integer, flag As String)
'纵坐标
Dim interval_n, i, j As Integer
Dim interval_p, picture_z As Single
interval_n = 1
i = 1
j = 1
interval_p = 0
picture_z = 0
If interval = 0 Then Exit Sub
Picture1.Line (100, 0)-(100, Picture_Height), RGB(0, 0, 0)
picture_z = (2 * CurrentD - 1) * ((Picture_Height) / PictureD / 2)
interval_n = Round(max_value / interval * 5) - 1
If interval_n = 0 Then Exit Sub
interval_p = (Picture_Height / PictureD / 2) / interval_n
For j = 1 To interval_n
Picture1.Line (100, picture_z - j * interval_p)-(160, picture_z - j * interval_p)
Picture1.Line (100, picture_z + j * interval_p)-(160, picture_z + j * interval_p)
Next j
For j = 1 To interval_n / 5 - 1
Picture1.Line (100, picture_z - j * 5 * interval_p)-(200, picture_z - j * 5 * interval_p)
If j * interval > 10 Then
Picture1.Print str(Round(j * interval))
Else
Picture1.Print str(j * interval)
End If
Next j
Picture1.Line (3000, picture_z - 5 * interval_p)-(3000, picture_z - 5 * interval_p)
Picture1.Print flag
For j = 1 To interval_n / 5 - 1
Picture1.Line (100, picture_z + j * 5 * interval_p)-(200, picture_z + j * 5 * interval_p)
If j * interval > 10 Then
Picture1.Print str(Round(-j * interval))
Else
Picture1.Print str(-j * interval)
End If
Next j
End Sub
Public Sub Draw_x_d(Picture_Width As Long, Picture_Height As Long, interval As Single)
'横坐标
Dim interval_n, i, j As Integer
Dim interval_p, picture_z As Single
interval_n = 1
i = 1
interval_p = 0
picture_z = 0
Picture1.Cls
picture_z = Picture_Height - 200
Picture1.Line (100, picture_z)-(Picture_Width, picture_z), RGB(0, 0, 0)
interval_n = Round((Max_xpeg - Min_xpeg) / interval * 5) '(Max_xpeg - Min_xpeg)为道路长度
If interval_n = 0 Then interval_n = 1
interval_p = (Picture_Width - 200) / interval_n
For i = 1 To interval_n
Picture1.Line (100 + i * interval_p, picture_z - 40)-(100 + i * interval_p, picture_z)
Next i
For i = 1 To interval_n / 5
Picture1.Line (100 + i * 5 * interval_p, picture_z - 100)-(100 + i * 5 * interval_p, picture_z)
Picture1.Print Round(i * interval + Min_xpeg)
Next i
End Sub
Public Sub Draw_y_d(Picture_Height As Long, interval As Single, max_value As Double, PictureD As Integer, CurrentD As Integer)
'纵坐标
Dim interval_n, i, j As Integer
Dim interval_p, picture_z As Single
interval_n = 1
i = 1
j = 1
interval_p = 0
picture_z = 0
If interval = 0 Then Exit Sub
Picture1.Line (100, 0)-(100, Picture_Height), RGB(0, 0, 0)
picture_z = Picture_Height - 200
interval_n = Round(max_value / interval * 5) - 1
If interval_n = 0 Then Exit Sub
interval_p = (Picture_Height - 200) / interval_n
For j = 1 To interval_n
Picture1.Line (100, picture_z - j * interval_p)-(160, picture_z - j * interval_p)
Picture1.Line (100, picture_z + j * interval_p)-(160, picture_z + j * interval_p)
Next j
For j = 1 To interval_n / 5 - 1
Picture1.Line (100, picture_z - j * 5 * interval_p)-(200, picture_z - j * 5 * interval_p)
If j * interval > 10 Then
Picture1.Print str(Round(j * interval))
Else
Picture1.Print str(j * interval)
End If
Next j
Picture1.Line (3000, picture_z - 2 * CurrentD * interval_p)-(3000, picture_z - 2 * CurrentD * interval_p)
Picture1.Print flag
End Sub
Public Sub Draw_y_a(Picture_Height As Long, Picture_Width, interval As Single, max_value As Double, PictureD As Integer, CurrentD As Integer, flag As String)
'纵坐标
Dim interval_n, i, j As Integer
Dim interval_p, picture_z As Single
interval_n = 1
i = 1
j = 1
interval_p = 0
picture_z = 0
If interval = 0 Then Exit Sub
Picture1.Line (Picture_Width - 100, 0)-(Picture_Width - 100, Picture_Height), RGB(0, 0, 0)
picture_z = Picture_Height - 200
interval_n = Round(max_value / interval * 5) - 1
If interval_n = 0 Then Exit Sub
interval_p = (Picture_Height - 200) / interval_n
For j = 1 To interval_n
Picture1.Line (Picture_Width - 100, picture_z - j * interval_p)-(Picture_Width - 160, picture_z - j * interval_p)
Picture1.Line (Picture_Width - 100, picture_z + j * interval_p)-(Picture_Width - 160, picture_z + j * interval_p)
Next j
For j = 1 To interval_n / 5 - 1
Picture1.Line (Picture_Width - 100, picture_z - j * 5 * interval_p)-(Picture_Width - 200, picture_z - j * 5 * interval_p)
If j * interval > 1 Then
Picture1.DrawWidth = 1
Picture1.DrawStyle = 1
Picture1.Line (Picture_Width - 500, picture_z - j * 5 * interval_p)-(Picture_Width - 500, picture_z - j * 5 * interval_p)
Picture1.Print str(Round(j * interval))
Else
Picture1.DrawWidth = 1
Picture1.DrawStyle = 1
Picture1.Line (Picture_Width - 500, picture_z - j * 5 * interval_p)-(Picture_Width - 500, picture_z - j * 5 * interval_p)
Picture1.Print str(Round(j * interval))
End If
Next j
Picture1.DrawWidth = 2
Picture1.DrawStyle = 1
Picture1.Line (Picture_Width - 2000, picture_z - 2 * CurrentD * interval_p)-(Picture_Width - 2000, picture_z - 2 * CurrentD * interval_p)
Picture1.Print flag
End Sub