okm how do i code this
Me.CreateGraphics.DrawPie
sorry i just need to draw a shape..thanks!
Printable View
okm how do i code this
Me.CreateGraphics.DrawPie
sorry i just need to draw a shape..thanks!
Override the OnPaint method.
dont follow.
please give some code!
Ok here ya go.
You are going to have to override the OnPaint Method. Thats the method that gets called when the form paints itself. Here is an example.
VB Code:
'This will get called each time the form is painted Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs) Dim g As Graphics = pe.Graphics g.DrawPie(Pens.Red, New Rectangle(New Point(10, 30), New Size(90, 90)), 90, 90) End Sub
If you dont want to override the OnPaint Method and you want to draw on the form from a buttonClick, you can do this.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = Me.CreateGraphics() g.DrawPie(Pens.Red, New Rectangle(New Point(30, 60), New Size(90, 90)), 90, 90) End Sub
You can do that to any control on your form.
Suppose you wanted to draw on a TabControl on your form. You would do this:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = TabControl1.CreateGraphics() g.DrawPie(Pens.Red, New Rectangle(New Point(30, 60), New Size(90, 90)), 90, 90) End Sub