Aracılığıyla paylaş


Image.GetPropertyItem(Int32) Yöntem

Tanım

Belirtilen özellik öğesini bu Imageöğesinden alır.

public:
 System::Drawing::Imaging::PropertyItem ^ GetPropertyItem(int propid);
public System.Drawing.Imaging.PropertyItem? GetPropertyItem(int propid);
public System.Drawing.Imaging.PropertyItem GetPropertyItem(int propid);
member this.GetPropertyItem : int -> System.Drawing.Imaging.PropertyItem
Public Function GetPropertyItem (propid As Integer) As PropertyItem

Parametreler

propid
Int32

Alınacak özellik öğesinin kimliği.

Döndürülenler

Bu PropertyItem yöntem alır.

Özel durumlar

Bu görüntünün görüntü biçimi özellik öğelerini desteklemiyor.

Örnekler

Aşağıdaki kod örneğinde ve SetPropertyItem yöntemlerinin GetPropertyItem nasıl kullanılacağı gösterilmektedir. Bu örnek, kimlik değeri geçirmeyi çağırır GetPropertyItem . Kimlik değerlerinin listesi için bkz Id. . Bu örnek, Windows Forms ile kullanılacak şekilde tasarlanmıştır. Bu örneği çalıştırmak için bir forma yapıştırın ve yöntemini çağırarak formun PaintDemonstratePropertyItem olayını işleyip e olarak PaintEventArgsgeçirin.

private:
   void DemonstratePropertyItem( PaintEventArgs^ e )
   {
      // Create two images.
      Image^ image1 = Image::FromFile( "c:\\FakePhoto1.jpg" );
      Image^ image2 = Image::FromFile( "c:\\FakePhoto2.jpg" );

      // Get a PropertyItem from image1.
      PropertyItem^ propItem = image1->GetPropertyItem( 20624 );

      // Change the ID of the PropertyItem.
      propItem->Id = 20625;

      // Set the PropertyItem for image2.
      image2->SetPropertyItem( propItem );

      // Draw the image.
      e->Graphics->DrawImage( image2, 20.0F, 20.0F );
   }
private void DemonstratePropertyItem(PaintEventArgs e)
{

    // Create two images.
    Image image1 = Image.FromFile("c:\\FakePhoto1.jpg");
    Image image2 = Image.FromFile("c:\\FakePhoto2.jpg");

    // Get a PropertyItem from image1.
    PropertyItem propItem = image1.GetPropertyItem(20624);

    // Change the ID of the PropertyItem.
    propItem.Id = 20625;

    // Set the PropertyItem for image2.
    image2.SetPropertyItem(propItem);

    // Draw the image.
    e.Graphics.DrawImage(image2, 20.0F, 20.0F);
}
Private Sub DemonstratePropertyItem(ByVal e As PaintEventArgs)

    ' Create two images.
    Dim image1 As Image = Image.FromFile("c:\FakePhoto1.jpg")
    Dim image2 As Image = Image.FromFile("c:\FakePhoto2.jpg")

    ' Get a PropertyItem from image1.
    Dim propItem As PropertyItem = image1.GetPropertyItem(20624)

    ' Change the ID of the PropertyItem.
    propItem.Id = 20625

    ' Set the PropertyItem for image2.
    image2.SetPropertyItem(propItem)

    ' Draw the image.
    e.Graphics.DrawImage(image2, 20.0F, 20.0F)
End Sub

Açıklamalar

Özellik öğesi kimliklerinin listesi ve daha fazla bilgi için bkz Id. .

Sınıfın ortak oluşturucuları olmadığından PropertyItem özellik öğelerini ayarlamak zordur. Bu kısıtlamaya geçici bir PropertyItem çözüm olarak özellik değerini alarak PropertyItems veya zaten özellik öğelerine sahip bir yöntemini çağırarak GetPropertyItem bir Image elde etmek gerekir. Ardından alanlarını PropertyItem ayarlayabilir ve öğesine SetPropertyItemgeçirebilirsiniz.

Şunlara uygulanır