基于AE输出JPEG等格式的图片

基于AE输出JPEG等格式的图片

以下是vb.net代码

Public Sub exportJPG(ByVal mapView As IActiveView)
        Try
            Dim strFilter As String = "JPEG文件(*.jpeg)|*.jpeg|BMP文件(*.bmp)|*.bmp"
            Dim pdlg As SaveFileDialog = New SaveFileDialog
            pdlg.Title = "地图另存为"
            pdlg.Filter = strFilter
            pdlg.OverwritePrompt = True
            pdlg.ShowDialog()
                      If Not pdlg.FileName.Equals("") Then
                Dim rectOut As tagRECT
                rectOut = mapView.ExportFrame
                Dim pExporter As IExport = New ExportJPEG

                '根据输出格式的不同实例化不同的Export对象
                If pdlg.FileName.ToLower.EndsWith("jpeg") Then
                    pExporter = New ExportJPEG
                ElseIf pdlg.FileName.ToLower.EndsWith("bmp") Then
                    pExporter = New ExportBMP
                End If

                Dim pEnv As IEnvelope = New Envelope
                pEnv.PutCoords(rectOut.left, rectOut.top, rectOut.right, rectOut.bottom)

                pExporter.PixelBounds = pEnv
                pExporter.ExportFileName = pdlg.FileName
                Dim DPI As Int64 = pExporter.Resolution
                Dim hdc As Int64 = pExporter.StartExporting()
                mapView.Output(hdc, DPI, rectOut, Nothing, Nothing)
                pExporter.FinishExporting()
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

你可能感兴趣的:(图片)