在picturebox上用Graphics绘图后,使用DrawToBitmap进行图片保存,保存下来的都是空白,求解
Bitmap bit = new Bitmap(this.Width, this.Height);
mypanel.DrawToBitmap(bit, Rectangle.FromLTRB(0, 0, this.Width, this.Height));
bit.Save("D:\\a.bmp");

解决方案 »

  1.   

    用CreateGraphics画出来的不可以,Paint事件中的可以.
      

  2.   

    private void pictureBox1_Paint(object sender, PaintEventArgs e)
            {
             SizeF z= new SizeF(200, 150);
              float fx = this.pictureBox1 .Width / z.Width;
             float fy = this.pictureBox1 .Height / z.Height;
              e.Graphics.ScaleTransform(fx, fy);
             e.Graphics.DrawEllipse(Pens.Blue, new RectangleF(0, 0, sizeF.Width, sizeF.Height));
            }