System.Windows.Forms.PictureBox pictureBox1
pictureBox1.Load("D:\1.jpg");
void FlushShow(Bitmap bmp)
{
if (null == bmp) return;
Graphics grap = Graphics.FromImage(bmp);
grap.PageUnit = GraphicsUnit.Pixel;
var font = new Font("宋体", 20, GraphicsUnit.Point);
var brush = new SolidBrush(Color.Blue);
grap.DrawString("一二三四", font, brush, 50, 50);
grap.DrawRectangle(new Pen(Color.Red,10), new Rectangle(10, 10, 200, 200));
grap.Dispose();
Point ptLoction = new Point(bmp.Size);
if (ptLoction.X > pictureBox1.Size.Width || ptLoction.Y > pictureBox1.Size.Height)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
else
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
pictureBox1.Image = bmp;
}