下面的示例从文件 Compass.bmp 构造 Image 对象。原始图像的宽度为 640 像素,高度为 479 像素。该代码创建宽度和高度均为 100 像素的缩略图像。
下面的插图显示此缩略图像。
Dim image As New Bitmap("Compass.bmp") Dim pThumbnail As Image = image.GetThumbnailImage(100, 100, Nothing, _ New IntPtr()) e.Graphics.DrawImage( _ pThumbnail, _ 10, _ 10, _ pThumbnail.Width, _ pThumbnail.Height) |