Wednesday, March 28, 2012

what is the .net equivalent of PSet? *RESOLVED*

i want to set a pixel. how do i do this?You can do use SetPixel function of Bitmap object.

Public Sub SetPixel_Example(e As PaintEventArgs)
' Create a Bitmap object of 100x100 pixels.
Dim myBitmap As New Bitmap(100,100)
' Draw myBitmap to the screen.
e.Graphics.DrawImage(myBitmap, 0, 0, myBitmap.Width, _
myBitmap.Height)
' Set each pixel in myBitmap to black.
Dim Xcount As Integer
For Xcount = 0 To myBitmap.Width - 1
Dim Ycount As Integer
For Ycount = 0 To myBitmap.Height - 1
myBitmap.SetPixel(Xcount, Ycount, Color.Black)
Next Ycount
Next Xcount
' Draw myBitmap to the screen again.
e.Graphics.DrawImage(myBitmap, myBitmap.Width, 0, myBitmap.Width, _
myBitmap.Height)
End Sub
nevermind, i just made a circle with a radius of one.

0 comments:

Post a Comment