Returns a thumbnail for this Image.
Assembly: System.Drawing (in System.Drawing.dll)
Public Function GetThumbnailImage ( _
thumbWidth As Integer, _
thumbHeight As Integer, _
callback As Image..::..GetThumbnailImageAbort, _
callbackData As IntPtr _
) As Imagepublic Image GetThumbnailImage(
int thumbWidth,
int thumbHeight,
Image..::..GetThumbnailImageAbort callback,
IntPtr callbackData
)public:
Image^ GetThumbnailImage(
int thumbWidth,
int thumbHeight,
Image..::..GetThumbnailImageAbort^ callback,
IntPtr callbackData
)member GetThumbnailImage :
thumbWidth:int *
thumbHeight:int *
callback:Image..::..GetThumbnailImageAbort *
callbackData:IntPtr -> Image
Parameters
- thumbWidth
- Type: System
. . :: . Int32
The width, in pixels, of the requested thumbnail image.
- thumbHeight
- Type: System
. . :: . Int32
The height, in pixels, of the requested thumbnail image.
- callback
- Type: System.Drawing
. . :: . Image. . :: . GetThumbnailImageAbort
A Image. . :: . GetThumbnailImageAbort delegate.
Note You must create a delegate and pass a reference to the delegate as the callback parameter, but the delegate is not used.
- callbackData
- Type: System
. . :: . IntPtr
Must be Zero.
If the Image contains an embedded thumbnail image, this method retrieves the embedded thumbnail and scales it to the requested size. If the Image does not contain an embedded thumbnail image, this method creates a thumbnail image by scaling the main image.
The GetThumbnailImage method works well when the requested thumbnail image has a size of about 120 x 120 pixels. If you request a large thumbnail image (for example, 300 x 300) from an Image that has an embedded thumbnail, there could be a noticeable loss of quality in the thumbnail image. It might be better to scale the main image (instead of scaling the embedded thumbnail) by calling the DrawImage method.
The following code example creates and displays a thumbnail image. This delegate is never called.
Public Function ThumbnailCallback() As Boolean
Return False
End Function
Public Sub Example_GetThumb(ByVal e As PaintEventArgs)
Dim myCallback As New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
Dim myBitmap As New Bitmap("Climber.jpg")
Dim myThumbnail As Image = myBitmap.GetThumbnailImage(40, 40, myCallback, IntPtr.Zero)
e.Graphics.DrawImage(myThumbnail, 150, 75)
End Sub
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);
}
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.