picturebox问题,急~~~~急~~~~进来看看也给分
我想在picturebox上为我接收的数据打点做曲线图(横向打点)
可从picturebox的左边依次打到右边后,再打的点就显示不了了,怎么办?
我要的是医院心电图的效果,新打的点从一端顺序显示,旧的点从另一端顺序消失.
跪求思路或解决办法!
[解决办法]
依次递减X坐标,重画。
[解决办法]
帮顶
不过不是很明白你的意思
你是不是要先从左打到右再从右打到左?
[解决办法]
顶
[解决办法]
Option Explicit
把你的picturebox放在另一个作为容器的picture box里
我这里 picture1作为容器,
然后在picture2里画图
每次移动picture位置即可
并且增加宽度,以达到不会移到边框的目的
其他显示的边框之类的,请自己调试
Private Sub Command1_Click()
Me.Picture2.Left = Me.Picture2.Left - 100
Me.Picture2.Width = Me.Picture2.Width + 100
End Sub
Private Sub Form_Load()
Picture2.Line (0, 0)-(10000, 500), vbRed
End Sub
[解决办法]
ls的正解,
或者你加个滚动条也可以,滚动条移动触发移动事件。
这样还能看到以前的数据图
[解决办法]
提供用于仿记录仪的代码:
Option Explicit
Dim quitflag As Boolean
Dim cmdXianshiFlag As Boolean
Dim cmdTestFlag As Boolean
Dim p As Integer
Dim h As Integer
Dim miao1 As Integer
Dim fen1 As Integer
Dim j As Integer
Dim ii As Integer
Dim br_br As Double
Dim ab_bm As Double
Dim wy_wy As Double
Dim shijian(360) As String * 10
Dim shijian_zh(360) As String * 10
'dim n1 As String * 10
Dim record_zh(5, 360) As Single
Dim record(5, 360) As Single
Dim c(360) As Variant
Dim k As Integer
Dim miao As Integer
Dim mmm As Integer
Dim colvb As Long
Dim xx As Integer
Dim yy As Integer
Dim txt As String
Dim fnt As Integer
Dim wp As Variant
Const a = 3.141592654 * 2
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 cmdExit_Click()
End
End Sub
Private Sub CmdTest_Click()
If cmdTestFlag Then
For j = 0 To 359
record(0, j) = 0
record(1, j) = 0
record(2, j) = 0
record(3, j) = 0
record(4, j) = 0
record(5, j) = 0
Next j
cmdTest.Caption = "试验 "
Else
For j = 0 To 359
c(j) = j * a / 60
record(0, j) = Sin(c(j)) * -450
record(1, j) = Sin(c(j)) * -300
record(2, j) = Sin(c(j) + a / 3) * -450
record(3, j) = Sin(c(j) + 2 * a / 3) * -450
record(4, j) = Sin(c(j) + 2 * a / 3) * -300
record(5, j) = Sin(c(j) + 2 * a / 3) * -150
Next j
cmdTest.Caption = "记录 "
End If
cmdTestFlag = Not cmdTestFlag
End Sub
Private Sub Form_Unload(Cancel As Integer)
quitflag = True
Unload Me
End Sub
Private Sub Timer1_Timer()
If lblTime.Caption <> CStr(Time$) Then
lblTime.Caption = Time$
Frmjly.Caption = "记录仪 " & Space(90) & Date$ & Space(6) & Time$
miao1 = Mid(lblTime, 7, 2)
fen1 = Mid(Time$, 4, 2)
If fen1 = 0 And miao1 = 0 Then
shijian(0) = lblTime
End If
Label1 = lblTime
If miao1 = 0 Then
For k = 0 To 358
record_zh(0, k + 1) = record(0, k)
record_zh(1, k + 1) = record(1, k)
record_zh(2, k + 1) = record(2, k)
record_zh(3, k + 1) = record(3, k)
record_zh(4, k + 1) = record(4, k)
record_zh(5, k + 1) = record(5, k)
Next k
For j = 1 To 359 '9
record(0, j) = record_zh(0, j)
record(1, j) = record_zh(1, j)
record(2, j) = record_zh(2, j)
record(3, j) = record_zh(3, j)
record(4, j) = record_zh(4, j)
record(5, j) = record_zh(5, j)
Next j
End If
If fen1 = 0 And miao1 = 1 Then
For ii = 0 To 5
shijian_zh(ii + 1) = shijian(ii)
Next ii
For h = 1 To 6
shijian(h) = shijian_zh(h)
Next h
Label1.Visible = False
Label2.Visible = True
End If
End If
End Sub
Private Sub Form_Load()
Show
Label8.Caption = " "
End Sub
以下接后答复
[解决办法]
使用数组做队列的办法就行了