日期:2014-05-17 浏览次数:21502 次
  System.Drawing.Image img = System.Drawing.Image.FromFile("c:\\1.jpg");
      float scale = 0; //缩放比例
       if(pictureBox1.Height>0)
      {
              if (img.Width / img.Height < pictureBox1.Width / pictureBox1.Height)
            {
                scale = (pictureBox1.Height * 1.0f) / img.Height;
            }
            else
            {
                scale = (pictureBox1.Width * 1.0f) / img.Width;
            }
       }