Bitmap.Cloneとは? わかりやすく解説

Bitmap.Clone メソッド (RectangleF, PixelFormat)

指定されPixelFormat 列挙体で定義されたこの Bitmapセクションコピー作成します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Function Clone ( _
    rect As RectangleF, _
    format As PixelFormat _
) As Bitmap
Dim instance As Bitmap
Dim rect As RectangleF
Dim format As PixelFormat
Dim returnValue As Bitmap

returnValue = instance.Clone(rect, format)
public Bitmap Clone (
    RectangleF rect,
    PixelFormat format
)
public:
Bitmap^ Clone (
    RectangleF rect, 
    PixelFormat format
)
public Bitmap Clone (
    RectangleF rect, 
    PixelFormat format
)
public function Clone (
    rect : RectangleF, 
    format : PixelFormat
) : Bitmap

パラメータ

rect

この Bitmapコピーする部分定義します

format

目的Bitmap の PixelFormat 列挙体を指定します

戻り値
このメソッド作成する Bitmap

例外例外
例外種類条件

OutOfMemoryException

rect は、ソース ビットマップ境界外側です。

ArgumentException

rect の高さまたは幅は 0 です。

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgs の e が必要です。このコード次のアクション実行します

Public Sub Clone_Example2(ByVal
 e As PaintEventArgs)

    ' Create a Bitmap object from a file.
    Dim myBitmap As New
 Bitmap("Grapes.jpg")

    ' Clone a portion of the Bitmap object.
    Dim cloneRect As New
 RectangleF(0, 0, 100, 100)
    Dim format As PixelFormat = myBitmap.PixelFormat
    Dim cloneBitmap As Bitmap = myBitmap.Clone(cloneRect,
 format)

    ' Draw the cloned portion of the Bitmap object.
    e.Graphics.DrawImage(cloneBitmap, 0, 0)
End Sub
public void Clone_Example2(PaintEventArgs e)
{
             
    // Create a Bitmap object from a file.
    Bitmap myBitmap = new Bitmap("Grapes.jpg");
             
    // Clone a portion of the Bitmap object.
    RectangleF cloneRect = new RectangleF(0, 0, 100, 100);
    System.Drawing.Imaging.PixelFormat format = 
        myBitmap.PixelFormat;
    Bitmap cloneBitmap = myBitmap.Clone(cloneRect, format);
             
    // Draw the cloned portion of the Bitmap object.
    e.Graphics.DrawImage(cloneBitmap, 0, 0);
}
public:
   void Clone_Example2( PaintEventArgs^ e )
   {
      // Create a Bitmap object from a file.
      Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );

      // Clone a portion of the Bitmap object.
      RectangleF cloneRect = RectangleF(0,0,100,100);
      System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
      Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );

      // Draw the cloned portion of the Bitmap object.
      e->Graphics->DrawImage( cloneBitmap, 0, 0 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Bitmap.Clone メソッド (Rectangle, PixelFormat)

Rectangle 構造体と、指定されPixelFormat 列挙体で定義された、この Bitmapセクションコピー作成します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Function Clone ( _
    rect As Rectangle, _
    format As PixelFormat _
) As Bitmap
Dim instance As Bitmap
Dim rect As Rectangle
Dim format As PixelFormat
Dim returnValue As Bitmap

returnValue = instance.Clone(rect, format)
public Bitmap Clone (
    Rectangle rect,
    PixelFormat format
)
public:
Bitmap^ Clone (
    Rectangle rect, 
    PixelFormat format
)
public Bitmap Clone (
    Rectangle rect, 
    PixelFormat format
)
public function Clone (
    rect : Rectangle, 
    format : PixelFormat
) : Bitmap

パラメータ

rect

この Bitmapコピーする部分定義します座標は、この Bitmap相対座標です。

format

目的Bitmap の PixelFormat 列挙体を指定します

戻り値
このメソッド作成する新しBitmap オブジェクト

例外例外
例外種類条件

OutOfMemoryException

rect は、ソース ビットマップ境界外側です。

ArgumentException

rect の高さまたは幅は 0 です。

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgs の e が必要です。このコード次のアクション実行します

Public Sub Clone_Example1(ByVal
 e As PaintEventArgs)

    ' Create a Bitmap object from a file.
    Dim myBitmap As New
 Bitmap("Grapes.jpg")

    ' Clone a portion of the Bitmap object.
    Dim cloneRect As New
 Rectangle(0, 0, 100, 100)
    Dim format As PixelFormat = myBitmap.PixelFormat
    Dim cloneBitmap As Bitmap = myBitmap.Clone(cloneRect,
 format)

    ' Draw the cloned portion of the Bitmap object.
    e.Graphics.DrawImage(cloneBitmap, 0, 0)
End Sub
public void Clone_Example1(PaintEventArgs e)
{
             
    // Create a Bitmap object from a file.
    Bitmap myBitmap = new Bitmap("Grapes.jpg");
             
    // Clone a portion of the Bitmap object.
    Rectangle cloneRect = new Rectangle(0, 0, 100, 100);
    System.Drawing.Imaging.PixelFormat format = 
        myBitmap.PixelFormat;
    Bitmap cloneBitmap = myBitmap.Clone(cloneRect, format);
             
    // Draw the cloned portion of the Bitmap object.
    e.Graphics.DrawImage(cloneBitmap, 0, 0);
}
public:
   void Clone_Example1( PaintEventArgs^ e )
   {
      // Create a Bitmap object from a file.
      Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );

      // Clone a portion of the Bitmap object.
      Rectangle cloneRect = Rectangle(0,0,100,100);
      System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
      Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );

      // Draw the cloned portion of the Bitmap object.
      e->Graphics->DrawImage( cloneBitmap, 0, 0 );
   }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Bitmap.Clone メソッド

指定された PixelFormat で定義されたこの Bitmapセクションコピー作成します
オーバーロードの一覧オーバーロードの一覧

名前 説明
Bitmap.Clone () 対象Image同一コピー作成します
Bitmap.Clone (Rectangle, PixelFormat) Rectangle 構造体と、指定されPixelFormat 列挙体で定義された、この Bitmapセクションコピー作成します
Bitmap.Clone (RectangleF, PixelFormat) 指定されPixelFormat 列挙体で定義されたこの Bitmapセクションコピー作成します
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Bitmap.Clone」の関連用語

Bitmap.Cloneのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Bitmap.Cloneのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS