|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Drawing One Simple Little LineHi,
I remember in VB6 that one could simply draw a line in a picturebox using the .Line method. There is no equivalent in .NET; everything I read says it is necessary to do lots of heavily complicated things to get it to happen. My question is, most of those new methods (the ones that take 25 lines of code) require that the drawing takes place in the OnPaint event of the picture box. This seems to imply that whatever is drawn in there must remain static for the whole program. How can one dynamically change, add, and erase lines, circles, and so forth during runtime?
Show quote
Hide quote
"Peter" <star***@hotmail.com> wrote in message I don't know how you get 25 lines of code. In the onpaint override just draw news:bkzZh.2550$296.1235@newsread4.news.pas.earthlink.net... > Hi, > > I remember in VB6 that one could simply draw a line in a picturebox using > the .Line method. There is no equivalent in .NET; everything I read says > it is necessary to do lots of heavily complicated things to get it to > happen. > > My question is, most of those new methods (the ones that take 25 lines of > code) require that the drawing takes place in the OnPaint event of the > picture box. This seems to imply that whatever is drawn in there must > remain static for the whole program. How can one dynamically change, add, > and erase lines, circles, and so forth during runtime? the line using e.Graphics.DrawLine. If you want to change what you're drawing then just draw a different line in OnPaint. Michael On May 1, 12:26 am, "Peter" <star***@hotmail.com> wrote: You don't have to use the OnPaint override, you can also get the> Hi, > > I remember in VB6 that one could simply draw a line in a picturebox using > the .Line method. There is no equivalent in .NET; everything I read says it > is necessary to do lots of heavily complicated things to get it to happen. > > My question is, most of those new methods (the ones that take 25 lines of > code) require that the drawing takes place in the OnPaint event of the > picture box. This seems to imply that whatever is drawn in there must remain > static for the whole program. How can one dynamically change, add, and erase > lines, circles, and so forth during runtime? Graphics object by doing "Dim g as Graphics = PictureBox.CreateGraphics." And in reality, once you get used to using GDI+ to do the drawing you will like it better than the VB6 methods (or at least I do). Thanks, Seth Rowe On May 1, 5:34 am, rowe_newsgroups <rowe_em***@yahoo.com> wrote:
> You don't have to use the OnPaint override, you can also get the Don't do this. See this article for more information:> Graphics object by doing "Dim g as Graphics = > PictureBox.CreateGraphics." And in reality, once you get used to using > GDI+ to do the drawing you will like it better than the VB6 methods > (or at least I do). http://www.bobpowell.net/picturebox.htm Also, check out his whole site: http://www.bobpowell.net Chris "rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message How are you going to paint again when it disappears though?news:1178015648.971618.206910@l77g2000hsb.googlegroups.com... > You don't have to use the OnPaint override, you can also get the > Graphics object by doing "Dim g as Graphics = > PictureBox.CreateGraphics." > And in reality, once you get used to using I totally and utterly agree. Dotnet's drawing is *far far* superior. Only > GDI+ to do the drawing you will like it better than the VB6 methods > (or at least I do). downside is the speed. Michael
Help with delegate callback error
Strange Date Problem Question about sending email via Visual Basic 2005 on a ASP.NET pa Problem with: Use the following method to smooth edges of screen fonts: if ClearType is selected Can someone help me with this menu? File.OpenWrite vs StreamWriter debug mode faster than bin\exe ? Forms Perform transaction on 2 databases on 2 different servers. Export procedure entry point in a dll |
|||||||||||||||||||||||