How to Paint in a Panel in Visual Basic
- 1). Create a new Visual Basic project by clicking File and New Project.
- 2). Browse through the Toolbox panel until you find the panel control. Drag it into the application form.
- 3). Right-click the panel control you just added and select Properties.
- 4). Click the event icon, which looks like a lightning bolt.
- 5). Double-click the Paint event to open the source code editor.
- 6). Paste the following code:
e.Graphics.FillEllipse(Brushes.Aquamarine, 0, 0, 30, 30)
e.Graphics.DrawEllipse(Pens.Black, 0, 50, 30, 30)
The first draws a filled, aquamarine circle at the top left of the panel control. The second draws a plain black circle 50 pixels down from the top left of the control. In each case, the width and height of the circles are 30 pixels.
Brushes are used to draw filled shapes, while Pens are used to draw shape outlines.
Source...