Bitmap.Clone Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Belirtilen Bitmapile tanımlanan bu PixelFormat bölümün bir kopyasını oluşturur.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| Clone(RectangleF, PixelFormat) |
Belirtilen Bitmap sabit listesiyle tanımlanan bu PixelFormat bölümün bir kopyasını oluşturur. |
| Clone(Rectangle, PixelFormat) |
Bu Bitmap bölümün yapısına Rectangle göre tanımlanan ve belirtilen PixelFormat bir numaralandırmayla bir kopyasını oluşturur. |
Clone(RectangleF, PixelFormat)
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
Belirtilen Bitmap sabit listesiyle tanımlanan bu PixelFormat bölümün bir kopyasını oluşturur.
public:
System::Drawing::Bitmap ^ Clone(System::Drawing::RectangleF rect, System::Drawing::Imaging::PixelFormat format);
public System.Drawing.Bitmap Clone(System.Drawing.RectangleF rect, System.Drawing.Imaging.PixelFormat format);
override this.Clone : System.Drawing.RectangleF * System.Drawing.Imaging.PixelFormat -> System.Drawing.Bitmap
Public Function Clone (rect As RectangleF, format As PixelFormat) As Bitmap
Parametreler
- rect
- RectangleF
Bunun Bitmap kopyalanacak bölümünü tanımlar.
- format
- PixelFormat
PixelFormat Hedef Bitmapiçin numaralandırmayı belirtir.
Döndürülenler
Bu yöntemin oluşturduğu Bitmap.
Özel durumlar
rect kaynak bit eşlem sınırlarının dışındadır.
Yüksekliği veya genişliği rect 0'dır.
Örnekler
Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve PaintEventArgs olay işleyicisinin bir parametresi olan ePaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:
Bir dosyadan bir Bitmap oluşturur.
Öğesinin bir bölümünü Bitmapklonlar.
Kopyalanan bölümü ekrana çizer.
private:
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 );
}
private 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);
}
Private 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
Şunlara uygulanır
Clone(Rectangle, PixelFormat)
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
- Kaynak:
- Bitmap.cs
Bu Bitmap bölümün yapısına Rectangle göre tanımlanan ve belirtilen PixelFormat bir numaralandırmayla bir kopyasını oluşturur.
public:
System::Drawing::Bitmap ^ Clone(System::Drawing::Rectangle rect, System::Drawing::Imaging::PixelFormat format);
public System.Drawing.Bitmap Clone(System.Drawing.Rectangle rect, System.Drawing.Imaging.PixelFormat format);
override this.Clone : System.Drawing.Rectangle * System.Drawing.Imaging.PixelFormat -> System.Drawing.Bitmap
Public Function Clone (rect As Rectangle, format As PixelFormat) As Bitmap
Parametreler
- format
- PixelFormat
Yeni Bitmapiçin piksel biçimi. Bu, ile Formatbaşlayan bir değer belirtmelidir.
Döndürülenler
Bu yöntemin oluşturduğu yeni Bitmap .
Özel durumlar
rect kaynak bit eşlem sınırlarının dışındadır.
Yüksekliği veya genişliği rect 0'dır.
-veya-
PixelFormat Adı Biçim ile başlamayan bir değer belirtilir. Örneğin, belirtilmesi Gdi bir ArgumentExceptionneden olur, ancak Format48bppRgb neden olmaz.
Örnekler
Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve PaintEventArgs olay işleyicisinin bir parametresi olan ePaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:
Bir dosyadan bir Bitmap oluşturur.
Öğesinin bir bölümünü Bitmapklonlar.
Kopyalanan bölümü ekrana çizer.
private:
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 );
}
private 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);
}
Private 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