wanhu128
路人甲
路人甲
  • 注册日期2005-08-09
  • 发帖数71
  • QQ
  • 铜币447枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1095回复:1

请问在AE实现到处图片的功能

楼主#
更多 发布于:2005-09-22 15:42
请问在AE实现到处图片的功能
喜欢0 评分0
kisssy
卧底
卧底
  • 注册日期2004-04-18
  • 发帖数235
  • QQ
  • 铜币614枚
  • 威望2点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-09-22 19:57
<P>Public Sub ExportActiveView(pActiveView As IActiveView)<BR> <BR>  'Create an ExportJPEG object and QI the pExport interface pointer onto it.<BR>  ' To export to a format other than JPEG, simply create a different CoClass here<BR>  ' and change the file extension of the ExportFileName.<BR>  Dim pExport As IExport<BR>  Set pExport = New ExportJPEG<BR>  pExport.ExportFileName = "C:\ExportTest1.jpg"</P>
<P>  <BR>  'Set the export object resolution to 96 dpi.  The default screen resolution for<BR>  ' MS Windows is usually 96dpi, and this value is also the default resolution for all<BR>  ' of the ArcGIS image format exporters.  The vector format exporters (PDF, AI, etc.)<BR>  ' default to 300 dpi, so we should explicitly set resolution here to be certain we<BR>  ' are working with a resolution of 96.<BR>  pExport.Resolution = 96<BR>  <BR>  'For both PageLayout and Map objects, the ExportFrame property always holds a tagRECT<BR>  ' structure appropriate for exporting.  The values in the tagRECT correspond to the width<BR>  ' and height to export, measured in pixels with an origin in the top left corner.<BR>  Dim exportRECT As tagRECT<BR>  exportRECT = pActiveView.ExportFrame<BR>  <BR>  'Create a new envelope object and populate it with the values from exportRECT.<BR>  ' We need to do this because the exporter object requires an envelope object<BR>  ' instead of a tagRECT structure.<BR>  Dim pPixelBoundsEnv As IEnvelope<BR>  Set pPixelBoundsEnv = New Envelope<BR>  pPixelBoundsEnv.PutCoords exportRECT.Left, exportRECT.Top, exportRECT.Right, exportRECT.bottom<BR>  <BR>  'Assign the envelope object to the exporter object's PixelBounds property.  The exporter object<BR>  ' will use these dimensions when allocating memory for the export file.<BR>  pExport.PixelBounds = pPixelBoundsEnv</P>
<P>  'Initialize the exporter object and store it's device context in the hDC variable.  At this method<BR>  ' call, the exporter object will create an empty file and allocate memory based on resolution,<BR>  ' bit depth, and pixel bounds.<BR>  Dim hDC As Long<BR>  hDC = pExport.StartExporting<BR>  <BR>  'Redraw the active view, rendering it to the exporter object device context instead of the app display.<BR>  'We pass the following values:<BR>  ' * hDC is the device context of the exporter object.<BR>  ' * pExport.Resolution is 96, the default resolution value for all image export formats.  Default screen<BR>  ' resolution for MS Windows is usually 96dpi.<BR>  ' * exportRECT is the tagRECT structure that describes the dimensions of the view that will be rendered.<BR>  ' The values in exportRECT should match those held in the exporter object's PixelBounds property.<BR>  pActiveView.Output hDC, pExport.Resolution, exportRECT, Nothing, Nothing<BR>  <BR>  'Finish writing the export file and cleanup any intermediate files.<BR>  pExport.FinishExporting<BR>  pExport.Cleanup<BR>  <BR>End Sub</P>
个人专栏: https://zhuanlan.zhihu.com/c_165676639
举报 回复(0) 喜欢(0)     评分
游客

返回顶部