Bitmap这几行代码错在哪里了????????
Bitmap oldPic = new Bitmap(路径);
int intHeight = 40;
int intWidth = (intHeight / oldPic.Height) * oldPic.Width;
Bitmap newPic = new Bitmap(oldPic,intWidth,intHeight);
newPic.Save(新路径);
如果把int intWidth = (intHeight / oldPic.Height) * oldPic.Width;
改成int intWidth = 50; 就没有任何问题
把代码改成
Bitmap oldPic = new Bitmap(路径);
int intHeight = 40;
int oldHeight = Convert.ToInt32(oldPic.Height);
int oldWidth = Convert.ToInt32(oldPic.Width);
int intWidth = (intHeight / oldHeight) * oldWidth; 或Convert.ToInt32( (intHeight / oldHeight) * oldWidth);
Bitmap newPic = new Bitmap(oldPic,intWidth,intHeight);
newPic.Save(新路径);
还是显示Bitmap newPic = new Bitmap(oldPic,intWidth,intHeight);这行代码的参数无效