本文整理汇总了VB.NET中System.Drawing.Image.PropertyItems属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Image.PropertyItems属性的具体用法?VB.NET Image.PropertyItems怎么用?VB.NET Image.PropertyItems使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Drawing.Image
的用法示例。
在下文中一共展示了Image.PropertyItems属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ExtractMetaData
Private Sub ExtractMetaData(ByVal e As PaintEventArgs)
Try
'Create an Image object.
Dim theImage As Image = New Bitmap("c:\fakePhoto.jpg")
'Get the PropertyItems property from image.
Dim propItems As PropertyItem() = theImage.PropertyItems
'Set up the display.
Dim font As New font("Arial", 10)
Dim blackBrush As New SolidBrush(Color.Black)
Dim X As Integer = 0
Dim Y As Integer = 0
'For each PropertyItem in the array, display the id, type, and length.
Dim count As Integer = 0
Dim propItem As PropertyItem
For Each propItem In propItems
e.Graphics.DrawString("Property Item " + count.ToString(), _
font, blackBrush, X, Y)
Y += font.Height
e.Graphics.DrawString(" iD: 0x" & propItem.Id.ToString("x"), _
font, blackBrush, X, Y)
Y += font.Height
e.Graphics.DrawString(" type: " & propItem.Type.ToString(), _
font, blackBrush, X, Y)
Y += font.Height
e.Graphics.DrawString(" length: " & propItem.Len.ToString() & _
" bytes", font, blackBrush, X, Y)
Y += font.Height
count += 1
Next propItem
font.Dispose()
Catch ex As ArgumentException
MessageBox.Show("There was an error. Make sure the path to the image file is valid.")
End Try
End Sub
示例2: MainClass
' 导入命名空间
Imports System.Drawing.Imaging
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class MainClass
public Shared Sub Main
Dim curImage As Image = Image.FromFile("yourfile.JPG")
Dim imgProperties As PropertyItem() = curImage.PropertyItems
Console.WriteLine(imgProperties.Length.ToString())
Dim i As Integer
For i = 0 To imgProperties.Length - 1
Console.WriteLine("Id :" + imgProperties(i).Id.ToString)
Console.WriteLine("Value:" + BitConverter.ToString(imgProperties(i).Value))
Next i
End Sub
End class