📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H80000012&
BorderStyle = 4 'Fixed ToolWindow
ClientHeight = 5985
ClientLeft = 15
ClientTop = 15
ClientWidth = 10785
ClipControls = 0 'False
ControlBox = 0 'False
FillStyle = 0 'Solid
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontTransparent = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5985
ScaleWidth = 10785
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Index = 2
Interval = 1000
Left = 3840
Top = 870
End
Begin VB.Timer Timer1
Index = 1
Interval = 1000
Left = 1260
Top = 1290
End
Begin VB.Timer Timer1
Index = 0
Interval = 1000
Left = 2760
Top = 750
End
Begin VB.CommandButton Command2
Caption = "Api"
Height = 405
Left = 3780
TabIndex = 1
Top = 210
Width = 1425
End
Begin VB.CommandButton Command1
Caption = "Normal"
Height = 405
Left = 780
TabIndex = 0
Top = 180
Width = 1425
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H00400000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 8130
TabIndex = 8
Top = 240
Width = 315
End
Begin VB.Label Label3
Alignment = 2 'Center
BackColor = &H00400000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 7800
TabIndex = 7
Top = 240
Width = 315
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H00400000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 7440
TabIndex = 6
Top = 240
Width = 315
End
Begin VB.Label TimeLabel
Alignment = 2 'Center
BackColor = &H00400000&
BorderStyle = 1 'Fixed Single
Caption = "0"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 375
Left = 5730
TabIndex = 5
Top = 240
Width = 1515
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000007&
Caption = "5400"
ForeColor = &H0000FF00&
Height = 225
Index = 2
Left = 10260
TabIndex = 4
Top = 5550
Width = 420
End
Begin VB.Line LineX
BorderColor = &H80000003&
Index = 1
X1 = 465
X2 = 10650
Y1 = 5475
Y2 = 5460
End
Begin VB.Line LineX
BorderColor = &H80000005&
Index = 0
X1 = 450
X2 = 10650
Y1 = 5490
Y2 = 5490
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H80000007&
Caption = "0"
ForeColor = &H0000FF00&
Height = 225
Index = 1
Left = 60
TabIndex = 3
Top = 5280
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000007&
Caption = "250"
ForeColor = &H0000FF00&
Height = 225
Index = 0
Left = 60
TabIndex = 2
Top = 1020
Width = 315
End
Begin VB.Line LineY
BorderColor = &H80000005&
Index = 1
X1 = 435
X2 = 435
Y1 = 1050
Y2 = 5520
End
Begin VB.Line LineY
BorderColor = &H80000003&
Index = 0
X1 = 420
X2 = 420
Y1 = 1020
Y2 = 5490
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim DataValue(16200) As Integer
Dim TempTime As Single
Dim CountLine As Integer
Private Sub Command1_Click()
Dim i As Integer, StepY As Single, StepX As Single
Dim TempTime As Single
'生成随即数
Me.Cls
For i = 0 To 16119
DataValue(i) = 100 + Rnd * 100
Next
StepX = (LineX(0).X2 - LineX(0).X1) / 5400
StepY = (LineY(0).Y2 - LineY(0).Y1) / 250
For i = 0 To 16119
DataValue(i) = LineX(0).Y1 - DataValue(i) * StepY
Next
'开始画线
TempTime = Timer
For i = 0 To 5399
PSet (i * StepX, DataValue(i * 3)), vbRed
PSet (i * StepX, DataValue(i * 3 + 1)), vbBlue
PSet (i * StepX, DataValue(i * 3 + 2)), vbGreen
Next
TimeLabel = Timer - TempTime
'画线结束
End Sub
Private Sub Command2_Click()
Timer1(0).Enabled = Not Timer1(0).Enabled
Timer1(1).Enabled = Not Timer1(1).Enabled
Timer1(2).Enabled = Not Timer1(2).Enabled
End Sub
Private Sub Timer1_Timer(Index As Integer)
Dim i As Integer, StepY As Single, StepX As Single
'生成随即数
If Index = 0 Then
Me.Cls
CountLine = 1
Label4 = ""
Label2 = 1
Label2.Refresh
For i = 0 To 5399
DataValue(i * 3) = 10 + Rnd * 10
Next
End If
If Index = 1 Then
CountLine = CountLine + 1
Label2 = ""
Label3 = 1
Label3.Refresh
For i = 0 To 5399
DataValue(i * 3 + 1) = 50 + Rnd * 50
Next
End If
If Index = 2 Then
CountLine = CountLine + 1
Label3 = ""
Label4 = 1
Label4.Refresh
For i = 0 To 5399
DataValue(i * 3 + 2) = 150 + Rnd * 100
Next
End If
StepX = (LineX(0).X2 - LineX(0).X1) / 5400
StepY = (LineY(0).Y2 - LineY(0).Y1) / 250
For i = 0 To 5399
DataValue(i * 3 + Index) = LineX(0).Y1 - DataValue(i * 3 + Index) * StepY
Next
'开始画线
If Index = 0 Then
TempTime = Timer
End If
For i = 0 To 5399
If Index = 0 Then
PSet (i * StepX, DataValue(i * 3 + Index)), vbRed
ElseIf Index = 1 Then
PSet (i * StepX, DataValue(i * 3 + Index)), vbBlue
Else
PSet (i * StepX, DataValue(i * 3 + Index)), vbGreen
End If
Next
If Index = 1 Then
TimeLabel = Timer - TempTime
End If
'画线结束
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -