|
阅读:905回复:0
[求助]帮我看看这个输出图片的代码!
<P>主要是想输出PageLayoutControl的当前视图为JPG图片,不过不想要PageLayoutControl中设置的框线,不过我怎么改参数都有那个包含地图的框。郁闷!</P>
<P>Dim pActiveView As IActiveView<BR> Set pActiveView = PageLayoutControl1.ActiveView<BR> Dim pEnv As IEnvelope<BR> Set pEnv = New Envelope<BR> With pEnv<BR> .XMin = 2.8919<BR> .YMin = 8.7233<BR> .Width = 15.2136<BR> .Height = 12.2502<BR> End With<BR> pActiveView.Extent = pEnv<BR> pActiveView.Refresh<BR> '输出设置<BR> Dim pExport As IExport<BR> Set pExport = New ExportJPEG<BR> '设置输出文件名称<BR> pExport.ExportFileName = "d:\6.jpg"<BR> <BR> <BR> Dim iOutputResolution As Integer<BR> Dim iScreenResolution As Integer<BR> iScreenResolution = 96 'default screen resolution is usually 96dpi<BR> iOutputResolution = 192<BR> pExport.Resolution = iOutputResolution<BR> <BR> <BR> Dim exportRECT As tagRECT<BR> With exportRECT<BR> .Left = 0<BR> .Top = 0<BR> .Right = pActiveView.ExportFrame.Right * (iOutputResolution / iScreenResolution)<BR> .Bottom = pActiveView.ExportFrame.Bottom * (iOutputResolution / iScreenResolution)<BR> <BR> End With</P> <P> <BR> Dim pEnvelop As IEnvelope<BR> Set pEnvelop = New Envelope<BR> pEnvelop.PutCoords exportRECT.Left, exportRECT.Top, exportRECT.Right, exportRECT.Bottom<BR> pExport.PixelBounds = pEnvelop<BR> <BR> Dim hDC As Long<BR> hDC = pExport.StartExporting<BR> <BR> pActiveView.Output hDC, pExport.Resolution, exportRECT, Nothing, Nothing<BR> <BR> pExport.FinishExporting</P> |
|