نکته شماره 17 :

 

این کاررا با دوروش میشه انجام داد

روش اول:

using System.Drawing;
 
void New_file(PictureBox pb)
{
bmp_image = newBitmap(pb.Width, pb.Height);
g = Graphics.FromImage(bmp_image);
g.FillRectangle(Brushes.White, newRectangle(0, 0, bmp_image.Width, bmp_image.Height));
pb.Image = bmp_image;
}
 
روش دوم:
private Image CreateBitmap()
{
System.Drawing.Bitmap flag = new System.Drawing.Bitmap(10, 10);
for (int x = 0; x < flag.Height; ++x)
for (int y = 0; y < flag.Width; ++y)
flag.SetPixel(x, y, Color.White);
for (int x = 0; x < flag.Height; ++x)
flag.SetPixel(x, x, Color.Red);
return flag;
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Image = CreateBitmap();
}