📄 form1.vb
字号:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MaxXAxis = 0
Train(10, 0.2)
PictureBox1.Invalidate()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim input As String = TBInput.Text
Dim output As String = ""
Recognition(input, output)
TBOutput.Text = output
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
PictureBox1.Invalidate()
End Sub
Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
If MaxXAxis = 0 Then Exit Sub
Dim i, x1, y1, x2, y2 As Integer
Dim max As Double = -20
Dim g As Graphics = e.Graphics
For i = 0 To MaxXAxis
If max < PicValue(i, 1) Then
max = PicValue(i, 1)
End If
Next
For i = 1 To MaxXAxis
x2 = Convert.ToInt16(PicValue(i, 0))
y2 = Math.Round(PicValue(i, 1) / max * 100)
x1 = x2 - 1
y1 = Math.Round(PicValue(i - 1, 1) / max * 100)
g.DrawLine(Pens.Red, x1, 100 - y1, x2, 100 - y2)
Next
g.DrawLine(Pens.Green, 0, 0, 0, 100)
g.DrawLine(Pens.Green, 0, 100, 500, 100)
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -