I have a large application that has numerous places where I define pens using code like this :
If I define the pens in one place and then afterward use :Code:MyPen = New Pen(Color.FromArgb(Red , Green, Blue), ws)
is that ok or should I instead define the pen right where I have Using like this :Code:Using MyPen Graphics.FromImage(bmp).DrawLine(MyPen, p1, p2) End Using
If it doesn't make any difference then I can save myself an enormous amount of work but if there is a very good reason to do it like the code immediately above shows then I can make the conversion. My application is working just fine the way it is now and I'm not using "Using ... End Using" at all but I'm guessing that my application may be using up more system resources if I'm not using "Using ... End Using". It would be nice if the code :Code:Using MyPen = New Pen(Color.FromArgb(Red , Green, Blue), ws) Graphics.FromImage(bmp).DrawLine(MyPen, p1, p2) End Using
is just as efficient where I first define the pen in one place and then draw with the Using ...End Using block.Code:Using MyPen Graphics.FromImage(bmp).DrawLine(MyPen, p1, p2) End Using




Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.
Reply With Quote