Image.GetThumbnailImage メソッド

定義

この Image のサムネイルを返します。

public:
 System::Drawing::Image ^ GetThumbnailImage(int thumbWidth, int thumbHeight, System::Drawing::Image::GetThumbnailImageAbort ^ callback, IntPtr callbackData);
public System.Drawing.Image GetThumbnailImage (int thumbWidth, int thumbHeight, System.Drawing.Image.GetThumbnailImageAbort callback, IntPtr callbackData);
public System.Drawing.Image GetThumbnailImage (int thumbWidth, int thumbHeight, System.Drawing.Image.GetThumbnailImageAbort? callback, IntPtr callbackData);
member this.GetThumbnailImage : int * int * System.Drawing.Image.GetThumbnailImageAbort * nativeint -> System.Drawing.Image
Public Function GetThumbnailImage (thumbWidth As Integer, thumbHeight As Integer, callback As Image.GetThumbnailImageAbort, callbackData As IntPtr) As Image

パラメーター

thumbWidth
Int32

要求されたサムネイル イメージの幅 (ピクセル単位)。

thumbHeight
Int32

要求されたサムネイル イメージの高さ (ピクセル単位)。

callback
Image.GetThumbnailImageAbort

Image.GetThumbnailImageAbort デリゲート。

callback パラメーターには、デリゲートを作成し、そのデリゲートへの参照を渡す必要がありす。ただし、このデリゲートは使用されません。

callbackData
IntPtr

nativeint

Zeroである必要があります。

戻り値

サムネイルを表す Image

次のコード例では、サムネイル画像を作成して表示します。 このデリゲートは呼び出されません。

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);
}

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

注釈

Image 埋め込みサムネイル画像が含まれている場合、このメソッドは埋め込まれたサムネイルを取得し、要求されたサイズにスケーリングします。 にImage埋め込まれたサムネイル画像が含まれていない場合、このメソッドはメインイメージをスケーリングしてサムネイルイメージを作成します。

このメソッドは GetThumbnailImage 、要求されたサムネイル画像のサイズが約 120 x 120 ピクセルの場合に適切に機能します。 サムネイルが埋め込まれている から大きなサムネイル画像 (300 x 300 など) Image を要求すると、サムネイル画像の品質が著しく低下する可能性があります。 メソッドを呼び出して、(埋め込みサムネイルをスケーリングするのではなく) メインイメージをDrawImageスケーリングすることをお勧めします。

適用対象