; System.Drawing.Image myThumbnail = null;
try
{
Bitmap myBitmap = new Bitmap(Path);
X = myBitmap.Width;
Y = myBitmap.Height;
decimal a = (decimal)X / (decimal)Y;//原图片的比例
decimal b = (decimal)Width / (decimal)Height;//相框的比例
System.Drawing.Image.GetThumbnailImageAbort myCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallBack);
int newheight, newwidth;
if (b > a)
{
newheight = Height;
newwidth =(int) decimal.Round(newheight * a,0,MidpointRounding.AwayFromZero);
}
else
{
newwidth = Width;
newheight = (int)decimal.Round(Width / a, 0, MidpointRounding.AwayFromZero);
}
myThumbnail = myBitmap.GetThumbnailImage(newwidth, newheight, myCallBack, Int