private Point GetImageSize(Image objImage, int imgHeight, int imgWidth) { decimal desWidth;decimal desHeight; //目标宽高 decimal radioAct = (decimal)objImage.Width/(decimal)objImage.Height; //原始图片的宽高比 decimal radioLoc = (decimal)imgWidth/(decimal)imgHeight; //图片位的宽高比 if(radioAct > radioLoc) //原始图片比图片位宽 { decimal dcmZoom = (decimal)imgWidth/(decimal)objImage.Width; desHeight = objImage.Height*dcmZoom; desWidth = imgWidth; } else { decimal dcmZoom = (decimal)imgHeight/(decimal)objImage.Height; desWidth = objImage.Width*dcmZoom; desHeight = imgHeight; } Point p =new Point((int)desWidth,(int)desHeight); return p; } 代码中的第一个Image参数是表示原始图片。 返回的Point类型中X属性代表了宽,Y属性代表了高度。