[codebox]Public Class Form1
Public Class panel_in_out
Inherits Panel
Dim ParentForm As Form
Dim myPanel As panel_in_out
Dim textBox1 As TextBox
Dim label1 As Label
Dim button1 As Button
'left
Dim x As Integer
'top
Dim y As Integer
Public Sub CreatePanel(ByVal parentForm, ByVal x, ByVal y)
textBox1 = New TextBox()
label1 = New Label()
button1 = New Button()
' Initialize the Panel control.
Me.Name = "Panel"
Me.Location = New Point(x, y)
Me.Size = New Size(parentForm.Width \ 2, parentForm.Height - y)
' Set the Borderstyle for the Panel to three-dimensional.
Me.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
' Initialize the Label, TextBox controls and button.
label1.Location = New Point(16, 16)
label1.Text = "label1"
label1.Size = New Size(104, 16)
textBox1.Location = New Point(16, 32)
textBox1.Text = ""
textBox1.Size = New Size(152, 20)
button1.Location = New Point(16, 52)
button1.Text = "Закрыть"
button1.Size = New Size(152, 20)
' Add the Label and TextBox controls to the Panel.
Me.Controls.Add(label1)
Me.Controls.Add(textBox1)
Me.Controls.Add(button1)
' Add the Panel control to the form.
parentForm.Controls.Add(Me)
AddHandler button1.Click, AddressOf myClick1
End Sub
Public Sub myClick1(ByVal sender As Object, ByVal e As EventArgs)
Me.Dispose()
End Sub
End Class
' Создается панель на форме
Private Sub ОбменToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ОбменToolStripMenuItem.Click
Dim panel1 As New panel_in_out
panel1.CreatePanel(Me, 0, MenuStrip1.Height)
End Sub
End Class[/codebox]