By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,590 Members | 663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,590 IT Pros & Developers. It's quick & easy.

drawing ellipse

P: n/a
Hi all,

I'm trying to draw an ellipse in my form but I'm not able to do that.
Dim cPiPen As New Pen(Color.Magenta, 3)

Me.CreateGraphics.DrawEllipse(cPiPen, 0.0F, 0.0F, 300.0F, 300.0F)

The problem is when I put these lines in my form_load method nothing is
drawed.

Any ideas?

Thanks

xavi
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Xavier Valdés" <no*****@teleline.es> schrieb:
I'm trying to draw an ellipse in my form but I'm not able to do that.
Dim cPiPen As New Pen(Color.Magenta, 3)

Me.CreateGraphics.DrawEllipse(cPiPen, 0.0F, 0.0F, 300.0F, 300.0F)

The problem is when I put these lines in my form_load method nothing is
drawed.


"drawed" -> "drawn" :-).

Instead of adding the code to the form's 'Load' event handler, add it to its
overridden 'OnPaint' method or the 'Paint' event handler:

\\\
e.Graphics.DrawEllipse(...)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2

P: n/a
Thanks 4 correction!
I'm trying to draw it in my OnPaint method but nothing happens.
Perhaps the problem is that my application is not an exe but a .net
component.
Any ideas?
Thanks,
Xavi
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el mensaje
news:uN*************@TK2MSFTNGP09.phx.gbl...
"Xavier Valdés" <no*****@teleline.es> schrieb:
I'm trying to draw an ellipse in my form but I'm not able to do that.
Dim cPiPen As New Pen(Color.Magenta, 3)

Me.CreateGraphics.DrawEllipse(cPiPen, 0.0F, 0.0F, 300.0F, 300.0F)

The problem is when I put these lines in my form_load method nothing is
drawed.


"drawed" -> "drawn" :-).

Instead of adding the code to the form's 'Load' event handler, add it to
its overridden 'OnPaint' method or the 'Paint' event handler:

\\\
e.Graphics.DrawEllipse(...)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

P: n/a
"Xavier Valdés" <no*****@teleline.es> schrieb:
I'm trying to draw it in my OnPaint method but nothing happens.
Perhaps the problem is that my application is not an exe but a .net
component.


Components don't have a graphical interface. You'll have to add the code to
a form or control.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.