本文整理汇总了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