Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
F2.Show()
End Sub
End Class
Public Class Form2
Private X As Integer
Private PX As Integer
Private PY As Integer
Private oldX As Integer
Private oldY As Integer
Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Application.DoEvents()
Display()
End Sub
Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'F2.Dispose()
F2.Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
F2 = Me
sample = 10
HDIV = 1
Application.DoEvents()
Display()
End Sub
Private Sub Display()
Dim I As Integer
Dim Div As Single
Dim w As Integer = ClientRectangle.Width - 20
Dim h As Integer = ClientRectangle.Height - 20
Dim g As Graphics = CreateGraphics()
g.TranslateTransform(20, h / 2) '座標原点設定
g.ScaleTransform(1, -1)
For X = 0 To Index - 1
PY = mData(X)
If (X = 0) Then
PX = 0
oldX = PX
oldY = mData(0)
Else
PX = PX + HDIV
g.DrawLine(Pens.Red, oldX, oldY, PX, PY)
oldX = PX
oldY = PY
End If
Next
End Sub
End Class
Module Module1
Public F1 As New Form1
Public F2 As New Form2
Public sample As Integer
Public HDIV As Integer