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

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

ImageCodecInfo.GetImageEncoders メソッド

GDI+組み込まれイメージ エンコーダに関する情報格納する ImageCodecInfo オブジェクト配列返します

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

Public Shared Function GetImageEncoders
 As ImageCodecInfo()
Dim returnValue As ImageCodecInfo()

returnValue = ImageCodecInfo.GetImageEncoders
public static ImageCodecInfo[] GetImageEncoders
 ()
public:
static array<ImageCodecInfo^>^ GetImageEncoders ()
public static ImageCodecInfo[] GetImageEncoders
 ()
public static function GetImageEncoders
 () : ImageCodecInfo[]

戻り値
ImageCodecInfo オブジェクト配列配列内のImageCodecInfo オブジェクトには、いずれか組み込みイメージ エンコーダに関する情報格納されています。

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコードGetImageEncoders メソッド使用してインストールされているすべてのイメージ エンコーダおよびコーデックに関するコーデック情報をすべて取り出し次に、各コーデックに関する情報画面描画ます。

Public Sub GetImageEncodersExample(ByVal
 e As PaintEventArgs)

    ' Get an array of available codecs.
    Dim myEncoders() As ImageCodecInfo
    myEncoders = ImageCodecInfo.GetImageEncoders()
    Dim numEncoders As Integer
 = myEncoders.GetLength(0)
    Dim strNumEncoders As String
 = numEncoders.ToString()
    Dim foreColor As Color = Color.Black
    Dim font As New Font("Arial",
 8)
    Dim i As Integer = 0

    ' Get the info. for all encoders in the array.
    If numEncoders > 0 Then
        Dim myEncoderInfo(numEncoders * 10) As
 String
        For i = 0 To numEncoders - 1
            myEncoderInfo((i * 10)) = "Codec Name = "
 _
            + myEncoders(i).CodecName
            myEncoderInfo((i * 10 + 1)) = "Class ID = "
 _
            + myEncoders(i).Clsid.ToString()
            myEncoderInfo((i * 10 + 2)) = "DLL Name = "
 _
            + myEncoders(i).DllName
            myEncoderInfo((i * 10 + 3)) = "Filename Ext. = "
 _
            + myEncoders(i).FilenameExtension
            myEncoderInfo((i * 10 + 4)) = "Flags = "
 _
            + myEncoders(i).Flags.ToString()
            myEncoderInfo((i * 10 + 5)) = "Format Descrip. = "
 _
            + myEncoders(i).FormatDescription
            myEncoderInfo((i * 10 + 6)) = "Format ID = "
 _
            + myEncoders(i).FormatID.ToString()
            myEncoderInfo((i * 10 + 7)) = "MimeType = "
 _
            + myEncoders(i).MimeType
            myEncoderInfo((i * 10 + 8)) = "Version = "
 _
            + myEncoders(i).Version.ToString()
            myEncoderInfo((i * 10 + 9)) = " "
        Next i
        Dim numMyEncoderInfo As Integer
 = myEncoderInfo.GetLength(0)

        ' Render to the screen all the information.
        Dim j As Integer
 = 20
        For i = 0 To numMyEncoderInfo - 1
            e.Graphics.DrawString(myEncoderInfo(i), font, _
            New SolidBrush(foreColor), 20, j)
            j += 12
        Next i
    Else
        e.Graphics.DrawString("No Encoders Found",
 font, _
        New SolidBrush(foreColor), 20, 20)
    End If
End Sub
private void GetImageEncodersExample(PaintEventArgs
 e)
{
             
    // Get an array of available codecs.
    ImageCodecInfo[] myCodecs;
    myCodecs = ImageCodecInfo.GetImageEncoders();
    int numCodecs = myCodecs.GetLength(0);
             
    //numCodecs = 1;
             
    // Set up display variables.
    Color foreColor = Color.Black;
    Font font = new Font("Arial", 8);
    int i = 0;
             
    // Check to determine whether any codecs were found.
    if(numCodecs > 0)
    {
             
        // Set up an array to hold codec information. There are 9
             
        // information elements plus 1 space for each codec, so 10 times
             
        // the number of codecs found is allocated.
        string[] myCodecInfo = new string[numCodecs*10];
             
        // Write all the codec information to the array.
        for(i=0;i<numCodecs;i++)
        {
            myCodecInfo[i*10] = "Codec Name = " + myCodecs[i].CodecName;
            myCodecInfo[(i*10)+1] = "Class ID = " +
                myCodecs[i].Clsid.ToString();
            myCodecInfo[(i*10)+2] = "DLL Name = " + myCodecs[i].DllName;
            myCodecInfo[(i*10)+3] = "Filename Ext. = " +
                myCodecs[i].FilenameExtension;
            myCodecInfo[(i*10)+4] = "Flags = " +
                myCodecs[i].Flags.ToString();
            myCodecInfo[(i*10)+5] = "Format Descrip. = " +
                myCodecs[i].FormatDescription;
            myCodecInfo[(i*10)+6] = "Format ID = " +
                myCodecs[i].FormatID.ToString();
            myCodecInfo[(i*10)+7] = "MimeType = " + myCodecs[i].MimeType;
            myCodecInfo[(i*10)+8] = "Version = " +
                myCodecs[i].Version.ToString();
            myCodecInfo[(i*10)+9] = " ";
        }
        int numMyCodecInfo = myCodecInfo.GetLength(0);
             
        // Render all of the information to the screen.
        int j=20;
        for(i=0;i<numMyCodecInfo;i++)
        {
            e.Graphics.DrawString(myCodecInfo[i],
                font,
                new SolidBrush(foreColor),
                20,
                j);
            j+=12;
        }
    }
    else
        e.Graphics.DrawString("No Codecs Found",
            font,
            new SolidBrush(foreColor),
            20,
            20);
}
private:
    void GetImageEncodersExample(PaintEventArgs^ e)
    {
        // Get an array of available codecs.
        array<ImageCodecInfo^>^ codecInfo;
        codecInfo = ImageCodecInfo::GetImageEncoders();
        int numCodecs = codecInfo->GetLength(0);

        //numCodecs = 1;

        // Set up display variables.
        Color^ foreColor = Color::Black;
        Drawing::Font^ font = gcnew Drawing::Font("Arial", 8);

        // Check to determine whether any codecs were found.
        if (numCodecs > 0)
        {
            // Set up an array to hold codec information. There are
 9
            // information elements plus 1 space for each codec, so
 10
            // times the number of codecs found is allocated.
            array<String^>^ codecInfoStrings = 
                gcnew array<String^>(numCodecs * 10);

            // Write all the codec information to the array.
            for (int i = 0; i < numCodecs;
 i++)
            {
                codecInfoStrings[i * 10] = "Codec Name = " +
                    codecInfo[i]->CodecName;
                codecInfoStrings[(i * 10) + 1] = "Class ID = " +
                    codecInfo[i]->Clsid.ToString();
                codecInfoStrings[(i * 10) + 2] = "DLL Name = " +
                    codecInfo[i]->DllName;
                codecInfoStrings[(i * 10) + 3] = "Filename Ext. = " +
                    codecInfo[i]->FilenameExtension;
                codecInfoStrings[(i * 10) + 4] = "Flags = " +
                    codecInfo[i]->Flags.ToString();
                codecInfoStrings[(i * 10) + 5] = "Format Descrip. = " +
                    codecInfo[i]->FormatDescription;
                codecInfoStrings[(i * 10) + 6] = "Format ID = " +
                    codecInfo[i]->FormatID.ToString();
                codecInfoStrings[(i * 10) + 7] = "MimeType = " +
                    codecInfo[i]->MimeType;
                codecInfoStrings[(i * 10) + 8] = "Version = " +
                    codecInfo[i]->Version.ToString();
                codecInfoStrings[(i * 10) + 9] = " ";
            }
            int numCodecInfo = codecInfoStrings->GetLength(0);

            // Render all of the information to the screen.
            int j = 20;
            for (int i = 0; i < numCodecInfo;
 i++)
            {
                e->Graphics->DrawString(codecInfoStrings[i],
                    font, gcnew SolidBrush(*foreColor), 20, (float)j);
                j += 12;
            }
        }
        else
            e->Graphics->DrawString("No Codecs Found",
                font, gcnew SolidBrush(*foreColor), 20, 20);
    }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ImageCodecInfo クラス
ImageCodecInfo メンバ
System.Drawing.Imaging 名前空間



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS