我是一个新手,第一次在这里请教各位高手。
想请问如何在Class里用指令画一个矩形框以下是我类的内容,程序做了画两个文本框和一个按钮,功能,我还想继续,画两个矩形框,但不知道如何在类里面实现???
Public Class OpSet
    Private startBox, stopBox As New TextBox, changeButton As New Button, Rectangle1, Rectangle2 As New Rectangle
    Private graphicsFun As Graphics, BrushColor As New SolidBrush(Color.Blue)
    Sub New(ByVal frm As Form, ByVal x As Integer, ByVal y As Integer)        startBox.Location = New Point(x, y)
        stopBox.Location = New Point(x + startBox.Size.Width + 50, y)        changeButton.Location = New Point(stopBox.Location.X + stopBox.Size.Width + 50, y)
        changeButton.Text = "confirm"        graphicsFun = frm.CreateGraphics
        graphicsFun.FillRectangle(BrushColor, x, changeButton.Location.Y + changeButton.Width + 50, 200, 10)
        AddHandler changeButton.Click, AddressOf changeButton_Click
        frm.Controls.AddRange({startBox, stopBox, changeButton})
    End Sub    Private Sub changeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim startNum, stopNum As Integer        If (Not Integer.TryParse(startBox.Text, startNum)) OrElse startNum < 0 OrElse startNum > 100 Then
            MessageBox.Show("Invalid start value")
            Exit Sub
        End If        If (Not Integer.TryParse(stopBox.Text, stopNum)) OrElse stopNum < 0 OrElse stopNum > 100 Then
            MessageBox.Show("Invalid stop value")
            Exit Sub
        End If
        MessageBox.Show("New values are: start = " & startNum.ToString & ", stop = " & stopNum.ToString)
    End Sub
End Class以下是我主画面的内容,在屏幕上添加了两组上面的类
Public Class Form1
    Private opsets As New List(Of OpSet)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        opsets.Add(New OpSet(Me, 100, 300))
        opsets.Add(New OpSet(Me, 100, 400))    End Sub    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        End
    End Sub
End Class还有个问题就是,如上程序,在屏幕上创建了4个文本框,这4个文本框的地址是什么?假如我在Form2上画了另一个文本框,想让Form2上的这个文本框的内容等于Form1文本框输入的数值,那么Form2 Load事件我就要写
TextBox1.Text=?????‘这个值希望就是Form1里某一个文本框的输入值,该怎么写。
谢谢