本文整理匯總了VB.NET中System.Drawing.Imaging.Encoder.SaveFlag字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET Encoder.SaveFlag字段的具體用法?VB.NET Encoder.SaveFlag怎麽用?VB.NET Encoder.SaveFlag使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。
在下文中一共展示了Encoder.SaveFlag字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example_MultiFrame
' 導入命名空間
Imports System.Drawing
Imports System.Drawing.Imaging
Class Example_MultiFrame
Public Shared Sub Main()
Dim multi As Bitmap
Dim page2 As Bitmap
Dim page3 As Bitmap
Dim myImageCodecInfo As ImageCodecInfo
Dim myEncoder As Encoder
Dim myEncoderParameter As EncoderParameter
Dim myEncoderParameters As EncoderParameters
' Create three Bitmap objects.
multi = New Bitmap("Shapes.bmp")
page2 = New Bitmap("Iron.jpg")
page3 = New Bitmap("House.png")
' Get an ImageCodecInfo object that represents the TIFF codec.
myImageCodecInfo = GetEncoderInfo("image/tiff")
' Create an Encoder object based on the GUID
' for the SaveFlag parameter category.
myEncoder = Encoder.SaveFlag
' Create an EncoderParameters object.
' An EncoderParameters object has an array of EncoderParameter
' objects. In this case, there is only one
' EncoderParameter object in the array.
myEncoderParameters = New EncoderParameters(1)
' Save the first page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, Fix(EncoderValue.MultiFrame))
myEncoderParameters.Param(0) = myEncoderParameter
multi.Save("Multiframe.tiff", myImageCodecInfo, myEncoderParameters)
' Save the second page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, Fix(EncoderValue.FrameDimensionPage))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(page2, myEncoderParameters)
' Save the third page (frame).
myEncoderParameter = New EncoderParameter(myEncoder, Fix(EncoderValue.FrameDimensionPage))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(page3, myEncoderParameters)
' Close the multiple-frame file.
myEncoderParameter = New EncoderParameter(myEncoder, Fix(EncoderValue.Flush))
myEncoderParameters.Param(0) = myEncoderParameter
multi.SaveAdd(myEncoderParameters)
End Sub
Private Shared Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo
Dim j As Integer
Dim encoders() As ImageCodecInfo
encoders = ImageCodecInfo.GetImageEncoders()
j = 0
While j < encoders.Length
If encoders(j).MimeType = mimeType Then
Return encoders(j)
End If
j += 1
End While
Return Nothing
End Function 'GetEncoderInfo
End Class