当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET Image.PropertyItems属性代码示例

本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System.Drawing,代码行数:45,代码来源:Image.PropertyItems

示例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
开发者ID:VB程序员,项目名称:System.Drawing,代码行数:19,代码来源:Image.PropertyItems


注:本文中的System.Drawing.Image.PropertyItems属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。