private void pictureBox2_Paint(object sender, PaintEventArgs e)
{
e.Graphics.PageUnit = GraphicsUnit.Millimeter;
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 100, 100);
} private void button2_Click_1(object sender, EventArgs e)
{
pictureBox2.Paint += new PaintEventHandler(pictureBox2_Paint);
Bitmap x = new Bitmap(pictureBox2.Width, pictureBox2.Height);
this.pictureBox2.DrawToBitmap(x, this.pictureBox2.ClientRectangle);//执行这句时才去激发pictureBox2_Paint
x.Save("d:\\2.jpg");
}结果是画图单位用GraphicsUnit.Millimeter后,只显示了一点。想必是与pictureBox2的高度和宽度单位不一致造成的。
如何把PictureBox控件的高度和宽度也设置成以mm为单位。
===================
按照运行的时的机器配置,建立像素与物理尺寸之间的一个换算关系,然后按照这种关系绘制应该可以。