GUI绘图

 Bitmap bitmap = new Bitmap(panel1.Height,panel1.Width); 
  
Graphics gc = Graphics.FromImage(bitmap);
Pen pen = new Pen(Color.Purple);
gc.DrawRectangle(pen, 0, 0, 40,40);
SolidBrush brush = new SolidBrush(Color.Black);
gc.FillRectangle(brush,0,0,20,20);
PictureBox picture = new PictureBox();
picture.Image = bitmap;
panel1.Controls.Add(picture);
 

你可能感兴趣的:(C#)