本文整理汇总了C#中System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders方法的典型用法代码示例。如果您正苦于以下问题:C# ImageCodecInfo.GetImageEncoders方法的具体用法?C# ImageCodecInfo.GetImageEncoders怎么用?C# ImageCodecInfo.GetImageEncoders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了ImageCodecInfo.GetImageEncoders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetImageEncodersExample
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);
}
开发者ID:.NET开发者,项目名称:System.Drawing.Imaging,代码行数:67,代码来源:ImageCodecInfo.GetImageEncoders
示例2: Main
//引入命名空间
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms;
public class MainClass {
public static void Main() {
ImageCodecInfo[] availableCodecs;
availableCodecs = ImageCodecInfo.GetImageEncoders();
int numCodecs = availableCodecs.Length;
for (int i = 0; i < numCodecs; i++)
{
Console.WriteLine("Codec Name = " + availableCodecs[i].CodecName);
Console.WriteLine("Class ID = " + availableCodecs[i].Clsid.ToString());
Console.WriteLine("Filename Extension = " +
availableCodecs[i].FilenameExtension);
Console.WriteLine("Flags = " +
availableCodecs[i].Flags.ToString());
Console.WriteLine("Format Description = " +
availableCodecs[i].FormatDescription);
Console.WriteLine("Format ID = " +
availableCodecs[i].FormatID.ToString());
Console.WriteLine("MimeType = " + availableCodecs[i].MimeType);
Console.WriteLine("Version = " +
availableCodecs[i].Version.ToString());
Console.WriteLine();
}
}
}
开发者ID:C#程序员,项目名称:System.Drawing.Imaging,代码行数:36,代码来源:ImageCodecInfo.GetImageEncoders
注:本文中的System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders方法示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论