How to draw circle using VB.Net

This code is used to Draw the circle in panel using VB.Net




Private Sub DrawCircle(ByVal cp As Point, ByVal radius As Integer)
Dim gr As Graphics
gr = Panel1.CreateGraphics
Dim rect As Rectangle = New Rectangle(cp.X - radius, cp.Y - radius, 2 * radius, 2 * radius)
gr.DrawEllipse(Pens.Black, rect)

End Sub

Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
DrawCircle(New Point(100, 100), 50)
End Sub



Comments

Author: sandhya bhavani06 Jun 2008 Member Level: Gold   Points : 2

Hi,

Article is good.But Using paint tat circle wil arrase.
My requirement is in vb.net
i hav taken one toolstrip control.
in tat toolbox some controls like circle,arrow,rectangle(all flowchar symbols).
once i click tat circle button in toolbox it shuld be placed in panel without arrasing.using paint it is arrasing

how to achieve this problem.
If any related articles are there or if u know how to impliment
just please help me out from this problem..

from 1 month onwards im trying..i am not getting any feasible solution..

Waiting for ur response

Thanks
Sandhya.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: