/*if (i.Size.Height != 168 || i.Size.Width != 104)
{
//===========处理图片缩小功能
System.Drawing.Image image = new Bitmap(aFile.FullName);//得到原图
System.Drawing.Image pThumbnail = image.GetThumbnailImage(168, 104, null, new IntPtr());  //创建缩小的图的大小
Graphics g=Graphics.FromImage(pThumbnail);
g.DrawImage(pThumbnail,10,10, pThumbnail.Width, pThumbnail.Height); //将原图画到缩小的图上
pThumbnail.Save(@"C:\WINNT\Temp\a.Jpeg",ImageFormat.Jpeg);  //保存
g.Dispose();
fs = new FileStream (@"C:\WINNT\Temp\a.Jpeg" , FileMode.OpenOrCreate, FileAccess.Read);
}
else
{
fs = new FileStream (@"" + directory , FileMode.OpenOrCreate, FileAccess.Read);
}*/

解决方案 »

  1.   

    Graphics.DrawImage可以指定源大小和位置,同时也可指定目标的大小和位置。
      

  2.   

    例如:
    Image imgFile=Image.FromFile(@yourImageFile);
    Bitmap myImage = new Bitmap(newWidth,newHeight); 
    Graphics g= Graphics.FromImage((Image)myImage); 
    g.DrawImage(imgFile,
                new Rectangle(0,0, imgFile.Width, imgFile.Height),
                new Rectangle(0,0, newWidth, newHeight),
                GraphicsUnit.Pixel); //Save file
    myImage.Save(yourFile);
      

  3.   

    你们的实现方式太复杂了以下是我的实现代码Image img = new Bitmap(@"c:\1.jpg");Image newImg = new Bitmap(img,100,100);
    this.pictureBox1.Image = newImg;