VB.NET
Using g As Graphics = e.Graphics
Using p As New Pen(Color.Black, 1)
g.DrawRectangle(p, 0, 0, MyPanel.Width - 1, MyPanel.Height)
End Using
End Using
C#
Using (Graphics g = e.Graphics) {
Using (Pen p = New Pen(Color.Black, 1)) {
g.DrawRectangle(p, 0, 0, MyPanel.Width - 1, MyPanel.Height);
}
}
You need to make sure that this code is put in the Paint event of your panel.