日期:2014-05-19  浏览次数:20788 次

这么将图片缩小 急!
这么将   120X160   的图片缩小   60X84的图片

------解决方案--------------------
以上方法来自MSDN的示例:
public bool ThumbnailCallback()
{
return false;
}
public void Example_GetThumb(PaintEventArgs e)
{
Image.GetThumbnailImageAbort myCallback =
new Image.GetThumbnailImageAbort(ThumbnailCallback);
Bitmap myBitmap = new Bitmap( "Climber.jpg ");
Image myThumbnail = myBitmap.GetThumbnailImage(
40, 40, myCallback, IntPtr.Zero);
e.Graphics.DrawImage(myThumbnail, 150, 75);
}
------解决方案--------------------
tmpbitmap.Save( "C:\\Pic\1.jpg ",System.Drawing.Imaging.ImageFormat.Jpeg);
------解决方案--------------------
把new去掉
------解决方案--------------------
示例:

public void DrawImageRect(PaintEventArgs e)
{

// Create image.
Image newImage = Image.FromFile( "SampImag.jpg ");

// Create rectangle for displaying image.
Rectangle destRect = new Rectangle(100, 100, 450, 150);

// Draw image to screen.
e.Graphics.DrawImage(newImage, destRect);
}