Image.SetPropertyItem メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Image.SetPropertyItem メソッドの意味・解説 

Image.SetPropertyItem メソッド

この Image に、プロパティ項目 (メタデータ一部) を格納します

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

Public Sub SetPropertyItem ( _
    propitem As PropertyItem _
)
Dim instance As Image
Dim propitem As PropertyItem

instance.SetPropertyItem(propitem)
public void SetPropertyItem (
    PropertyItem propitem
)
public:
void SetPropertyItem (
    PropertyItem^ propitem
)
public void SetPropertyItem (
    PropertyItem propitem
)
public function SetPropertyItem (
    propitem : PropertyItem
)

パラメータ

propitem

格納される PropertyItem。

戻り値
このメソッドは値を返しません。

例外例外
例外種類条件

ArgumentException

このイメージイメージ形式は、プロパティ項目をサポートしていません。

解説解説

イメージ形式プロパティ項目がサポートされていない場合、このメソッドArgumentExceptionスローし、"プロパティが見つかりません" というメッセージ表示しますイメージ形式プロパティ項目がサポートされていても、設定しようとするプロパティサポートされていない場合、このメソッドは、要求無視しますが例外スローしません。

PropertyItem クラスにはパブリック コンストラクタがないため、プロパティ項目の設定は困難です。この制約回避する方法1 つは、PropertyItems プロパティ値を取得するか、既にプロパティ項目を持つ Image の GetPropertyItem メソッド呼び出してPropertyItem取得することです。その後PropertyItemフィールド設定してSetPropertyItem に渡すことができます

使用例使用例

GetPropertyItem メソッドSetPropertyItem メソッド使用する方法次のコード例示します。この例は、Windows フォームでの使用意図してデザインされています。この例を実行するには、コードフォーム貼り付けe を PaintEventArgs として渡して DemonstratePropertyItem メソッド呼び出すことで、フォームPaint イベント処理します

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
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 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.set_Id(20625);

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

    // Draw the image.
    e.get_Graphics().DrawImage(image2, 20, 20);
} //DemonstratePropertyItem
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からImage.SetPropertyItem メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からImage.SetPropertyItem メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からImage.SetPropertyItem メソッド を検索

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

辞書ショートカット

すべての辞書の索引

Image.SetPropertyItem メソッドのお隣キーワード
検索ランキング

   

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



Image.SetPropertyItem メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS