Bootje
New member
- Joined
- Mar 17, 2008
- Messages
- 1
- Programming Experience
- Beginner
Hey
I want to draw in a user control, but for some reason it doesn't work. The user control colors blue, but I can't see a yellow circle. Maybe it would be better to make a panel - user control, but I don't know how to do this.
I want to draw in a user control, but for some reason it doesn't work. The user control colors blue, but I can't see a yellow circle. Maybe it would be better to make a panel - user control, but I don't know how to do this.
VB.NET:
Public Class cell
Private Sub cell_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Set Background of cell (panel)
pnlCell.BackColor = Color.Blue
'Draw circle in cell (panel)
DrawCircle(New Point(10, 10), 5)
End Sub
Private Sub DrawCircle(ByVal p As Point, ByVal radius As Integer)
Dim gr As Graphics = pnlCell.CreateGraphics
Dim rect As Rectangle = New Rectangle(p.X - radius, p.Y - radius, 2 * radius, 2 * radius)
gr.FillEllipse(Brushes.Yellow, rect)
End Sub
End Class