Private Sub Command1_Click()
sconstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\14-20070925.mdb"
con1.Open sconstr
If con1.State = 1 Then
Dim l_sqlstr As String
l_sqlstr = "select 外温,外压 from" & " aa "
cmdsel.CommandText = l_sqlstr
cmdsel.ActiveConnection = con1
Set rs = cmdsel.Execute
End If
rs.MoveFirst
I = 0
Do While Not rs.EOF
A(I, 1) = rs!外温
A(I, 2) = rs!外压
rs.MoveNext
I = I + 1
Loop
MsgBox "共有记录" & I & "个!"
rs.Close
Dim x0, y0, w
Dim k As Integer
x0 = Shape1.Left
y0 = Shape1.Top + Shape1.Height
w = 1
Picture1.ForeColor = QBColor(1)
Picture1.Cls
Picture1.AutoRedraw = True
For k = 0 To I - 2
Picture1.Line (x0 + k * w, (y0 - 20 * A(k, 1)))-(x0 + (k + 1) * w, (y0 - 20 * A(k + 1, 1))), QBColor(12)
Picture1.Line (x0 + k * w, (y0 - 20 * A(k, 2)))-(x0 + (k + 1) * w, (y0 - 20 * A(k + 1, 2))), QBColor(10)
Next
SavePicture Picture1.Image, "c:\123.jpg"
Picture1.Picture = LoadPicture("c:\123.jpg")
con1.Close
End Sub
在窗体load时画了一次,然后保存为了123.jpg,现在有一个按钮,点一下想让他重画,这样怎么不可以,哪错了??