110,533
社区成员
发帖
与我相关
我的任务
分享
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;
}
}