當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。