本文整理汇总了C#中System.Drawing.Image.PropertyItems属性的典型用法代码示例。如果您正苦于以下问题:C# Image.PropertyItems属性的具体用法?C# Image.PropertyItems怎么用?C# Image.PropertyItems使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Drawing.Image
的用法示例。
在下文中一共展示了Image.PropertyItems属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractMetaData
private void ExtractMetaData(PaintEventArgs e)
{
try
{
// Create an Image object.
Image theImage = new Bitmap("c:\\fakePhoto.jpg");
// Get the PropertyItems property from image.
PropertyItem[] propItems = theImage.PropertyItems;
// Set up the display.
Font font1 = new Font("Arial", 10);
SolidBrush blackBrush = new SolidBrush(Color.Black);
int X = 0;
int Y = 0;
// For each PropertyItem in the array, display the id,
// type, and length.
int count = 0;
foreach ( PropertyItem propItem in propItems )
{
e.Graphics.DrawString("Property Item " +
count.ToString(), font1, blackBrush, X, Y);
Y += font1.Height;
e.Graphics.DrawString(" ID: 0x" +
propItem.Id.ToString("x"), font1, blackBrush, X, Y);
Y += font1.Height;
e.Graphics.DrawString(" type: " +
propItem.Type.ToString(), font1, blackBrush, X, Y);
Y += font1.Height;
e.Graphics.DrawString(" length: " +
propItem.Len.ToString() +
" bytes", font1, blackBrush, X, Y);
Y += font1.Height;
count += 1;
}
font1.Dispose();
}
catch(Exception)
{
MessageBox.Show("There was an error." +
"Make sure the path to the image file is valid.");
}
}