0

シミュレーションを制御するための 1 つのフォーム。ステンドグラスの窓を表現するひとつのフォルム。

NumericUpDown1線を描画して表示したい数字のリストを含むがありますがSecondForm、プログラムを実行しようとすると何も表示されません これは私がコーディングした方法です

    Dim Redpen As New Pen(Color.Red)
    Dim i As Integer
    Dim MyGraphicsClass As Graphics = Me.CreateGraphics
    Dim a, b, c, d As Integer

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

    a = 0
    b = 20
    c = 30
    d = 50
End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

    NumericUpDown1.Dock = System.Windows.Forms.DockStyle.None
    NumericUpDown1.Maximum = 7
    NumericUpDown1.Minimum = 1
    Controls.Add(NumericUpDown1)
   End Sub

   Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        SecondForm.Show()
    If NumericUpDown1.DecimalPlaces = 1 Then
        MyGraphicsClass.DrawLine(Pens.Red, a, b, a, b)
    End If

    Number_Of_Lines = 2
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 2 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, c, a, c)
        End If
    Next i

    Number_Of_Lines = 3
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 3 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, d, a, d)
        End If
    Next i

    Number_Of_Lines = 4
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 4 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, c, a, c)
        End If
    Next i

    Number_Of_Lines = 5
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 5 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, b, a, b)
        End If
    Next i

    Number_Of_Lines = 6
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 6 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, c, a, c)
        End If
    Next i

    Number_Of_Lines = 7
    For i = 1 Number_Of_Lines Step 1
        If NumericUpDown1.DecimalPlaces = 7 Then
            MyGraphicsClass.DrawLine(Pens.Red, a, c, a, c)
        End If
    Next i
End Sub

クラス終了

4

2 に答える 2