Image.GetThumbnailImageメソッド

3169 ワード

Image.GetThumbnailImageメソッド


このImageオブジェクトのサムネイルを返します.
[Visual Basic]
Public Function GetThumbnailImage( _
   ByVal thumbWidth As Integer, _
   ByVal thumbHeight As Integer, _
   ByVal callback As Image.GetThumbnailImageAbort, _
   ByVal callbackData As IntPtr _
) As Image
[C#]
public Image GetThumbnailImage(
   int thumbWidth,
   int thumbHeight,
   Image.GetThumbnailImageAbort callback,
   IntPtr callbackData
);
[C++]
public: Image* GetThumbnailImage(
   int thumbWidth,
   int thumbHeight,
   Image.GetThumbnailImageAbort* callback,
   IntPtr callbackData
);
[JScript]
public function GetThumbnailImage(
   thumbWidth : int,
   thumbHeight : int,
   callback : Image.GetThumbnailImageAbort,
   callbackData : IntPtr
) : Image;

パラメータ


thumbWidth
要求されたサムネイルの幅(ピクセル単位).
thumbHeight
要求されたサムネイルの高さ(ピクセル単位).
callback
一つGetThumbnailImageAbort依頼.GDI+1.0版ではこの依頼は使用されません.それでも、委任を作成し、そのパラメータに委任の参照を渡す必要があります.
callbackData
IntPtrでなければなりません.Zero.

戻り値


サムネイルを表すイメージオブジェクト.

コメント


Imageオブジェクトに埋め込みサムネイル画像が含まれている場合、このメソッドは埋め込みサムネイルを取得し、必要なサイズにスケールします.イメージオブジェクトに埋め込みサムネイル画像が含まれていない場合、この方法では、メイン画像をスケールしてサムネイル画像を作成します.
要求されたサムネイルサイズが約120である場合×120の場合、GetThumbnailImageは正常に動作します.埋め込みサムネイルのあるImageオブジェクトから大きなサムネイル画像(例えば300)が要求された場合×300)では、サムネイル画像の品質が著しく低下する.埋め込みサムネイルではなくDrawImageを呼び出してメインイメージをスケールすると、より効果的になる可能性があります.


[C#]次の例では、サムネイル画像を作成して表示します.この依頼は呼び出されません.
[C#] 
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);
}