c# windows forms draw pixel
private void SetPixel_Example(PaintEventArgs e)
{
// Create a Bitmap object from a file.
Bitmap myBitmap = new Bitmap("Grapes.jpg");
// Draw myBitmap to the screen.
e.Graphics.DrawImage(myBitmap, 0, 0, myBitmap.Width,
myBitmap.Height);
// Set each pixel in myBitmap to black.
for (int Xcount = 0; Xcount < myBitmap.Width; Xcount++)
{
for (int Ycount = 0; Ycount < myBitmap.Height; Ycount++)
{
myBitmap.SetPixel(Xcount, Ycount, Color.Black);
}
}
// Draw myBitmap to the screen again.
e.Graphics.DrawImage(myBitmap, myBitmap.Width, 0,
myBitmap.Width, myBitmap.Height);
}
Also in C#:
- c# skip following code in loop
- how to use variables in c#
- c# string to lowercase
- c# display float with 2 decimal places
- converting letter to ascii
- c# how to exit program
- C# webclient immitate browser
- JavaScriptSerializer() and convert to base64
- c# capitalize first letter
- how to add array to list in c#
- winforms timer c#
- c# substring from index to end
- loop over enum values
- c# aspx return image
- import regex c#
- c# to vb.net
- c# loop datatable rows
- c# dynamic object get value
- can't add an editor script
- panel drag all form c#
- datagridview column color c#
- convert double to currency c#
- POST http://localhost:5001/api/v1/identity/login 500 (Internal Server Error) LoginForm.jsx:39 Error: Request failed with status code 500 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.handleLoad (xhr.js:61)
- asking for user input integer c#