Proe4.0使用VB.net生成縮略圖方法

Private Sub btnRasterImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRasterImage.Click
        Dim run As New pfcInterfaceExamples2
        Dim type As EpfcRasterType
        Try
            lblStatus.Text = ""
            If (txtImageFile.Text = "") Then
                MsgBox("Please enter Image File name", MsgBoxStyle.Critical)
            ElseIf (txtImageType.Text = "") Then
                MsgBox("Please select Image type", MsgBoxStyle.Critical)
            Else
                Select Case txtImageType.Text
                    Case "BMP"
                        type = EpfcRasterType.EpfcRASTER_BMP
                    Case "JPEG"
                        type = EpfcRasterType.EpfcRASTER_JPEG
                    Case "TIFF"
                        type = EpfcRasterType.EpfcRASTER_TIFF
                    Case "EPS"
                        type = EpfcRasterType.EpfcRASTER_EPS
                    Case Else
                        MsgBox("Incorrect Image type", MsgBoxStyle.Critical)
                        Exit Sub
                End Select

                run.outputImageScreen(asyncConnection.Session, type, txtImageFile.Text)
                lblStatus.Text = "Image Created"

            End If
        Catch ex As Exception
            lblStatus.Text = ""
            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
        End Try
    End Sub

Public Sub outputImageScreen(ByRef session As IpfcBaseSession, _
                                 ByVal type As Integer, _
                                 ByVal imageName As String)
        Dim instructions As IpfcRasterImageExportInstructions
        Dim imageExtension As String
        Dim rasterHeight As Double = 7.5
        Dim rasterWidth As Double = 10.0
        Dim dotsPerInch As Integer
        Dim imageDepth As Integer

        Try
            dotsPerInch = EpfcDotsPerInch.EpfcRASTERDPI_100
            imageDepth = EpfcRasterDepth.EpfcRASTERDEPTH_24

            instructions = getRasterInstructions(type, rasterWidth, _
                                                 rasterHeight, dotsPerInch, _
                                                 imageDepth)

            imageExtension = getRasterExtension(type)

            session.ExportCurrentRasterImage(imageName + imageExtension, instructions)

        Catch ex As Exception
            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
        End Try
    End Sub

發佈了27 篇原創文章 · 獲贊 4 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章