this creates streaks instead of dots. why ? I am trying to paint individual pixels. another method was also tried (using fillrectangle) , which also didn't give the desired result, got bars instead of dots.
protected override void OnPaint(PaintEventArgs pea )
{
Graphics g = pea.Graphics ;
for ( int y = 1 ; y <= Width ; y++ )
{
for ( int x = 1 ; x <= Height ; x++ )
{
System.Random rand = new System.Random() ;
Color c = (Color.FromArgb(rand.Next(256),
rand.Next(256),
rand.Next(256)));
// SolidBrush myBrush = new SolidBrush(c);
// g.FillRectangle(myBrush, x, y, 1, 1);
Bitmap pt = new Bitmap(1, 1);
pt.SetPixel(0, 0, c);
g.DrawImageUnscaled(pt, x, y);
}
}
}
what is happening here ?