After several years of resisting, I've finally been pushed form VB 6 into .NET. And I am kicking and screaming all the way thank you.
So, what I had before: Using VB 6 I developed an electronics cooling application. The code has a lot of translation routines (turning geometry options into nodes and resistors) and a bit of graphics (so users can see the board layouts and PWB stackups.)
What I have now: The port to VS 2005 when fairly smoothly given the size of the code and the fact that I am a mechanical engineer and not a software guy. But two (related) problems are frustrating me to no end. I have a handful of pictureboxes that I am drawing rectangles, lines, and strings to. That part seems to work fine.
What isn't working is the old "AutoRefresh". When I go to create the form with the picturebox and all the drawing entities, it first showed up blank. I figured out I need to do all the drawing in the paint event with a "g As Graphics = Me.Pic1.CreateGraphics" statement. But still, when the form first pops up, it is blank. Actually, you can see the picturebox getting populated and then it quickly blanks out. If I move another form over the top of it, then it redraws. Also, if I min/max the form, the image is erased.
Also, I'm trying to write the image in the picturebox to a file. Should be just a simple matter of "Pic1.Image.Save("c:\My Data\test.bmp")". But the error message says the Pic1.image is "Nothing" (emtpy, nada, blank, zippo, etc).
How can it be "Nothing" when I see the results of all my drawing efforts? I have even put in a test statement like "if Pic1.Image is nothing then....." right after a do a g.fillrectangle and it says that it is empty.
Keeping in mind that I just jumped into VB .NET, ca anybody explain to me what I am missing?
Thanks in advance
Pat
So, what I had before: Using VB 6 I developed an electronics cooling application. The code has a lot of translation routines (turning geometry options into nodes and resistors) and a bit of graphics (so users can see the board layouts and PWB stackups.)
What I have now: The port to VS 2005 when fairly smoothly given the size of the code and the fact that I am a mechanical engineer and not a software guy. But two (related) problems are frustrating me to no end. I have a handful of pictureboxes that I am drawing rectangles, lines, and strings to. That part seems to work fine.
What isn't working is the old "AutoRefresh". When I go to create the form with the picturebox and all the drawing entities, it first showed up blank. I figured out I need to do all the drawing in the paint event with a "g As Graphics = Me.Pic1.CreateGraphics" statement. But still, when the form first pops up, it is blank. Actually, you can see the picturebox getting populated and then it quickly blanks out. If I move another form over the top of it, then it redraws. Also, if I min/max the form, the image is erased.
Also, I'm trying to write the image in the picturebox to a file. Should be just a simple matter of "Pic1.Image.Save("c:\My Data\test.bmp")". But the error message says the Pic1.image is "Nothing" (emtpy, nada, blank, zippo, etc).
How can it be "Nothing" when I see the results of all my drawing efforts? I have even put in a test statement like "if Pic1.Image is nothing then....." right after a do a g.fillrectangle and it says that it is empty.
Keeping in mind that I just jumped into VB .NET, ca anybody explain to me what I am missing?
Thanks in advance
Pat