韩国人怕打仗:在vb中如何引用数据库中的数据在pictruebox中通过LINE工具画出曲线!最好能给出代码!

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 07:57:27

以下给出用于在pictruebox以LINE语句画曲线的代码:
Option Explicit'变量定义
Private gyhDate As String
Private chaxun11 As String
Private chaxun2 As String
Private zsl As Integer
Private wy_wy As Double
Private br_br As Double
Private quexian(9, 6000) As Variant'曲线变量
Private zsl1 As Integer
Private zsl11 As Integer
Private i As Integer
Private j As Integer
Private X As Integer
Private Y As Integer
Private fnt As Integer
Private txt As Variant
Private dd As Variant
'曲线显示文字函数
Public Function xp(colvb As Variant, xx As Variant, yy As Variant, txt As Variant)
Picture1.ForeColor = colvb 'QBColor(14)
Picture1.CurrentX = xx
Picture1.CurrentY = yy
Picture1.Print txt '
End Function
'数据查询
Private Sub DataGrid3_Click()
gyhDate = Adodc3.Recordset(0)
chaxun1 = "select * from jishijilu where gyh_riqi='" & gyhDate & "' order by shijian"
mdh = chaxun1
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"
Adodc1.RecordSource = mdh
Adodc1.Refresh
Adodc1.Recordset.MoveLast
'Text1 = gyhDate
chaxun11 = "select * from jishijilu where gyh_riqi='" & gyhDate & "'"
chaxun2 = " order by gyh_riqi,shijian"
mdh = chaxun11 & chaxun2
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"
Adodc2.RecordSource = mdh
Adodc2.Refresh
zsl = Adodc2.Recordset.RecordCount
Text2 = zsl
Adodc2.Recordset.MoveFirst
'将数据赋值于quexian(*, *)变量
For i = 0 To zsl - 1
quexian(0, i) = Adodc2.Recordset(0)
For j = 2 To 9
quexian(j, i) = Adodc2.Recordset(j)
Next j
Adodc2.Recordset.MoveNext
Next i
cmdQuxian.SetFocus
cmdRefh.Enabled = True
cmdPrint.Enabled = True
DataGrid3.Visible = False
End Sub
'初始化
Private Sub Form_Load()
chaxun1 = "select gyh_riqi from jishijilu where gyh_riqi >'" & "" & "' group by gyh_riqi"
mdh = chaxun1
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"
Adodc3.RecordSource = mdh
Adodc3.Refresh
Adodc3.Recordset.MoveLast
Picture2.Height = 6765
Picture1.Visible = False
cmdRefh.Enabled = False
End Sub
'显示曲线代码
Private Sub cmdQuxian_Click()
'HScroll1.Visible = True
DataGrid1.Visible = False
Adodc1.Visible = False
DataGrid3.Visible = False
Adodc3.Visible = False
Picture2.Height = 7245
Picture1.Visible = True
Picture1.Cls
'坐标文字
colvb = vbWhite
xx = 100
yy = 150
txt = "℃"
wp = xp(colvb, xx, yy, txt)
yy = 350
txt = "100"
wp = xp(colvb, xx, yy, txt)
xx = 200
yy = 1850
txt = "50"
wp = xp(colvb, xx, yy, txt)
yy = 3350
xx = 300
txt = "0"
wp = xp(colvb, xx, yy, txt)
xx = 100
yy = 4850
txt = "-50"
wp = xp(colvb, xx, yy, txt)
xx = 0
yy = 6350
txt = "-100"
wp = xp(colvb, xx, yy, txt)
xx = 10800 + 100
yy = 150
txt = "℃"
wp = xp(colvb, xx, yy, txt)
yy = 350
txt = "100"
wp = xp(colvb, xx, yy, txt)
xx = 10800 + 200
yy = 1850
txt = "50"
wp = xp(colvb, xx, yy, txt)
yy = 3350
xx = 10800 + 300
txt = "0"
wp = xp(colvb, xx, yy, txt)
xx = 10800 + 100
yy = 4850
txt = "-50"
wp = xp(colvb, xx, yy, txt)
xx = 10800 + 0
yy = 6350
txt = "-100"
wp = xp(colvb, xx, yy, txt)
'真空坐标

colvb = vbRed
xx = 11400
yy = 150
txt = "Pa"
wp = xp(colvb, xx, yy, txt)
yy = 350
txt = "1000"
wp = xp(colvb, xx, yy, txt)
xx = 11500
yy = 1850
txt = "100"
wp = xp(colvb, xx, yy, txt)
yy = 3350
xx = 11600
txt = "10"
wp = xp(colvb, xx, yy, txt)
xx = 11700
yy = 4850
txt = "1"
wp = xp(colvb, xx, yy, txt)
xx = 11500
yy = 6350
txt = "0.1"
wp = xp(colvb, xx, yy, txt)

xx = 500
yy = 150
txt = "Pa"
wp = xp(colvb, xx, yy, txt)
yy = 350
txt = "1000"
wp = xp(colvb, xx, yy, txt)
yy = 150
xx = 2200
txt = "6hr"
wp = xp(colvb, xx, yy, txt)
xx = 4000
txt = "12hr"
wp = xp(colvb, xx, yy, txt)
xx = 5800
txt = "18hr"
wp = xp(colvb, xx, yy, txt)
xx = 7600
txt = "24hr"
wp = xp(colvb, xx, yy, txt)
xx = 9400
txt = "30hr"
wp = xp(colvb, xx, yy, txt)
xx = 13000
txt = "42hr"
wp = xp(colvb, xx, yy, txt)
xx = 14800
txt = "48hr"
wp = xp(colvb, xx, yy, txt)
xx = 16600
txt = "54hr"
wp = xp(colvb, xx, yy, txt)
xx = 18400
txt = "60hr"
wp = xp(colvb, xx, yy, txt)
xx = 20200
txt = "66hr"
wp = xp(colvb, xx, yy, txt)
xx = 22000
txt = "72hr"
wp = xp(colvb, xx, yy, txt)
xx = 23800
txt = "78hr"
wp = xp(colvb, xx, yy, txt)
xx = 25600
txt = "84hr"
wp = xp(colvb, xx, yy, txt)
xx = 600
yy = 1850
txt = "100"
wp = xp(colvb, xx, yy, txt)
yy = 3350
xx = 11600
txt = "10"
wp = xp(colvb, xx, yy, txt)
xx = 700
yy = 4850
txt = "1"
wp = xp(colvb, xx, yy, txt)
xx = 600
yy = 6350
txt = "0.1"
wp = xp(colvb, xx, yy, txt)
xx = 22100
yy = 350
txt = "1000"
wp = xp(colvb, xx, yy, txt)
yy = 1850
txt = " 100"
wp = xp(colvb, xx, yy, txt)
yy = 3350
txt = " 10"
wp = xp(colvb, xx, yy, txt)
yy = 4850
txt = " 1"
wp = xp(colvb, xx, yy, txt)
yy = 6350
txt = " 0.1"
wp = xp(colvb, xx, yy, txt)
'画格
Picture1.ForeColor = vbWhite
Picture1.Line (450, 700)-(500, 700)
Picture1.Line (450, 1000)-(500, 1000)
Picture1.Line (450, 1300)-(500, 1300)
Picture1.Line (450, 1600)-(500, 1600)
Picture1.ForeColor = vbRed

Picture1.Line (500, 566.7)-(550, 566.7)
Picture1.Line (500, 733.3)-(550, 733.3)
Picture1.Line (500, 900)-(550, 900)
Picture1.Line (500, 1066.7)-(550, 1066.7)
Picture1.Line (500, 1233.3)-(550, 1233.3)
Picture1.Line (500, 1400)-(550, 1400)
Picture1.Line (500, 1566.7)-(550, 1566.7)
Picture1.Line (500, 1733.3)-(550, 1733.3)
Picture1.Line (500, 2066.7)-(550, 2066.7)
Picture1.Line (500, 2233.3)-(550, 2233.3)
Picture1.Line (500, 2400)-(550, 2400)
Picture1.Line (500, 2566.7)-(550, 2566.7)
Picture1.Line (500, 2733.3)-(550, 2733.3)
Picture1.Line (500, 2900)-(550, 2900)
Picture1.Line (500, 3066.7)-(550, 3066.7)
Picture1.Line (500, 3233.3)-(550, 3233.3)
Picture1.Line (500, 3566.7)-(550, 3566.7)
Picture1.Line (500, 3733.3)-(550, 3733.3)
Picture1.Line (500, 3900)-(550, 3900)
Picture1.Line (500, 4066.7)-(550, 4066.7)
Picture1.Line (500, 4233.3)-(550, 4233.3)
Picture1.Line (500, 4400)-(550, 4400)
Picture1.Line (500, 4566.7)-(550, 4566.7)
Picture1.Line (500, 4733.3)-(550, 4733.3)
Picture1.Line (500, 5066.7)-(550, 5066.7)
Picture1.Line (500, 5233.3)-(550, 5233.3)
Picture1.Line (500, 5400)-(550, 5400)
Picture1.Line (500, 5566.7)-(550, 5566.7)
Picture1.Line (500, 5733.3)-(550, 5733.3)
Picture1.Line (500, 5900)-(550, 5900)
Picture1.Line (500, 6066.7)-(550, 6066.7)
Picture1.Line (500, 6233.3)-(550, 6233.3)
Picture1.ForeColor = vbWhite
Picture1.Line (450, 400)-(25700, 400)
Picture1.Line (450, 1900)-(25700, 1900)
Picture1.Line (450, 3400)-(25700, 3400)
Picture1.Line (450, 4900)-(25700, 4900)
Picture1.Line (450, 6400)-(25700, 6400)
Picture1.Line (450, 2200)-(500, 2200)
Picture1.Line (450, 2500)-(500, 2500)
Picture1.Line (450, 2800)-(500, 2800)
Picture1.Line (450, 3100)-(500, 3100)
Picture1.Line (450, 3700)-(500, 3700)
Picture1.Line (450, 4000)-(500, 4000)
Picture1.Line (450, 4300)-(500, 4300)
Picture1.Line (450, 4600)-(500, 4600)
Picture1.Line (450, 5200)-(500, 5200)
Picture1.Line (450, 5500)-(500, 5500)
Picture1.Line (450, 5800)-(500, 5800)
Picture1.Line (450, 6100)-(500, 6100)
Picture1.Line (500, 400)-(500, 6400)
Picture1.Line (500 + 0, 400)-(500 + 0, 6400)
Picture1.Line (1400 + 0, 400)-(1400 + 0, 6400)
Picture1.Line (2300 + 0, 400)-(2300 + 0, 6400)
Picture1.Line (3200 + 0, 400)-(3200 + 0, 6400)
Picture1.Line (4100 + 0, 400)-(4100 + 0, 6400)
Picture1.Line (5000 + 0, 400)-(5000 + 0, 6400)
Picture1.Line (5900 + 0, 400)-(5900 + 0, 6400)
Picture1.Line (6800 + 0, 400)-(6800 + 0, 6400)
Picture1.Line (7700 + 0, 400)-(7700 + 0, 6400)
Picture1.Line (8600 + 0, 400)-(8600 + 0, 6400)
Picture1.Line (9500 + 0, 400)-(9500 + 0, 6400)
Picture1.Line (10400 + 0, 400)-(10400 + 0, 6400)
Picture1.Line (11300, 400)-(11300, 6400)
Picture1.Line (12200, 400)-(12200, 6400)
Picture1.Line (13100, 400)-(13100, 6400)
Picture1.Line (14000, 400)-(14000, 6400)
Picture1.Line (14900, 400)-(14900, 6400)
Picture1.Line (15800, 400)-(15800, 6400)
Picture1.Line (16700, 400)-(16700, 6400)
Picture1.Line (17600, 400)-(17600, 6400)
Picture1.Line (18500, 400)-(18500, 6400)
Picture1.Line (19400, 400)-(19400, 6400)
Picture1.Line (20300, 400)-(20300, 6400)
Picture1.Line (21200, 400)-(21200, 6400)
Picture1.Line (22100, 400)-(22100, 6400)
Picture1.Line (23000, 400)-(23000, 6400)
Picture1.Line (23900, 400)-(23900, 6400)
Picture1.Line (24800, 400)-(24800, 6400)
Picture1.Line (25700, 400)-(25700, 6400)
'画曲线
For j = 0 To zsl - 1
Picture1.Line (j * 5 + 500, quexian(2, j) * -30 + 3399)-(j * 5 + 500, quexian(2, j) * -30 + 3401), vbRed, BF
Picture1.Line (j * 5 + 500, quexian(3, j) * -30 + 3399)-(j * 5 + 500, quexian(3, j) * -30 + 3401), QBColor(7), BF
Picture1.Line (j * 5 + 500, quexian(4, j) * -30 + 3399)-(j * 5 + 500, quexian(4, j) * -30 + 3401), vbBlack, BF
Picture1.Line (j * 5 + 500, quexian(5, j) * -30 + 3399)-(j * 5 + 500, quexian(5, j) * -30 + 3401), vbYellow, BF
Picture1.Line (j * 5 + 500, quexian(6, j) * -30 + 3399)-(j * 5 + 500, quexian(6, j) * -30 + 3401), vbGreen, BF
'准对数处理
If quexian(8, j) < 1 Then
wy_wy = 0 + 166.7
br_br = 55
ElseIf quexian(8, j) >= 1 And quexian(8, j) < 10 Then
wy_wy = -1500 + 166.7
br_br = 5.5556
ElseIf quexian(8, j) >= 10 And quexian(8, j) < 100 Then
wy_wy = -3000 + 166.7
br_br = 0.5555
ElseIf quexian(8, j) >= 100 And quexian(8, j) < 1000 Then
wy_wy = -4500 + 166.7
br_br = 0.055555
End If
Picture1.Line (j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3395 + 3000)-(j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3405 + 3000), QBColor(11), BF
Next j
cmdExit.SetFocus
End Sub
以上代码需根据你实际处理数据情况修改,祝你成功!