sidwelle
asked on
pset in VB.net
Trying to set a pixel in a picturebox with out any luck.
Please look at the code and tell me what is missing.
If I set the 'bmTemp' to the image of the picturebox, why would I want an new instance as the error message suggests ? The picture box is empty, but does that mean is has no image at all ?
Please look at the code and tell me what is missing.
If I set the 'bmTemp' to the image of the picturebox, why would I want an new instance as the error message suggests ? The picture box is empty, but does that mean is has no image at all ?
Public Sub DrawAPixel(ByVal x As Integer, ByVal y As Integer, ByVal clr As Color)
Dim bmTemp As Bitmap
bmTemp = pctGraph.Image
Dim MyClr As Color
bmTemp.SetPixel(x, y, clr)
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also draw the pixels in the Paint() event of your PictureBox using the supplied "e.Graphics".
Store the data about which pixels to set in a class Level List type structure.
Which approach is better really depends on your application...
Store the data about which pixels to set in a class Level List type structure.
Which approach is better really depends on your application...
ASKER