Hello,
I'm trying to fill a windows form with red pixels.
My code is included bellow. I tried to place it in mouse down event handlers, paint event handlers but the result is mostly the same : the application slows down ( almost crashes) and does not display the pixels.
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
for (int i = 0; i < this.Width; i++)
{
for (int j = 0; j < this.Height; j++)
{
bmp.SetPixel(i, j, Color.Blue);
}
}
Graphics g = this.CreateGraphics();
g.DrawImage(bmp, new Point(0, 0));
bmp.Dispose();
}
Any help would be greatly appreciated.
Sebastian HarkoPosted May 4, 2007, 1:30 PM
That would work for filling the form with a certain color but the real thing is that I have to do an image viewer for an exotic format so I want to know how to place pixels somewhere on the form or on some object.
Richard BlythePosted May 4, 2007, 12:23 PM