Clairvoyant1332
Programmer
I have this app originally written in VB6 where I loop through each pixel in a picture control and set the color, doing a refresh after each line. When I converted this to .NET it was considerably slower.
Here's a simplified piece of the VB6 code:
And here's the VB.NET code
Is this the correct approach? Am I missing something?
Thanks,
Dennis
Here's a simplified piece of the VB6 code:
Code:
mypicture.autoredraw = true ' set at design time
for x = 1 to 600
for y = 1 to 400
mypicture.pset (x,y), vbblack ' there's more logic going on here, but this is the important part
next y
doevents
next x
And here's the VB.NET code
Code:
bmap = new bitmap(600,400,system.drawing.imaging.pixelformat.format24bpprgb)
mypicture.image = bmap ' these two lines done in form.load
for x = 1 to 600
for y = 1 to 400
bmap.setpixel(x,y,color.black) ' again, this is the important part
next y
mypicture.refresh()
system.windows.forms.application.doevents()
next x
Is this the correct approach? Am I missing something?
Thanks,
Dennis