版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、AE 中实现打印设置、打印预览、打印输出2012-05-27 10:10:14| 分类: AE 开发笔记|字号 订阅前提是已经实现“数据视图”与“版面视图”的联动打印设置如下:打印预览如下:打印输出如下:主窗体内添加字段ernal PrPreviewDialog prPreviewDialog1; ernal PrDialog prDialog1;private short m_CurrentPrPage;private ESRI.ArcGIS.esriSystem.ITrackCancel m_TrackCancel = new CancelTrackerClass();ernal Page
2、SetupDialog pageSetupDialog1;private System.Drawing.Pring.Pr= newSystem.Drawing.Pring.Pr();主窗体函数中添加InitializePrPreviewDialog(); /initialize the prpreview dialogprDialog1 = new PrDialog(); /create a prdialog objectInitializePageSetupDialog(); /itialize the page setup dialog添加自定义函数private void Initial
3、izePrPreviewDialog()/ create a new PrPreviewDialog using constructor prPreviewDialog1 = new PrPreviewDialog();/set the size, location, name and the minimum size the dialog can beresized topr pr prprPreviewDialog1.CntSize = new System.Drawing.Size(800, 600); PreviewDialog1.Location = new System.Drawi
4、ng.Po(29, 29); PreviewDialog1.Name = PrPreviewDialog1;PreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);/set UseAntiAlias to true to allow the operating system to smooth fontsprPreviewDialog1.UseAntiAlias = true;/assothis.te the evenndling method with thes PrPage event.PrPage += newSyst
5、em.Drawing.Pring.PrPageEvenndler(_PrPage);private void InitializePageSetupDialog()/create a negeSetupDialog using constructorpageSetupDialog1 = negeSetupDialog();/initialize the dialogs PrerSettings property to hold user defined prersettingspageSetupDialog1.PageSettings = new System.Drawing.Pring.Pa
6、geSettings();/initialize dialogs PrerSettings property to hold user set prer settings pageSetupDialog1.PrerSettings = newSystem.Drawing.Pring.PrerSettings();/do not show the networkhe prer dialogpageSetupDialog1.ShowNetwork = false;private void System.Drawing.PraxPageLayo_PrPage(objecder,ing.PrPageE
7、ventArgs e)ontrol1.Page.PageToPrerMap=esriPageToPrerMap.esriPageMapScale;/get the resolution of the graphics device used by the pr (including the graphics device)short dpi = (short)e.Graphics.DpiX;/envelope for the device boundaries IEnvelope devBounds = new EnvelopeClass();/get pagepreviewIPage pag
8、e = axPageLayoontrol1.Page;/the number of prshort prPageCount;ages the page will be pred onprPageCount = axPageLayoontrol1.get_Pr m_CurrentPrPage+;/the currently selected prerageCount(0);IPrrer = axPageLayoontrol1.Prer;page.GetDeviceBounds(prer, m_CurrentPrPage, 0, dpi, devBounds);/structure for the
9、 device boundaries tagRECT deviceRect;/Returns the coordinates of lower, left and upper, right corners double xmin, ymin, xmax, ymax;devBounds.QueryCoords(out xmin, out ymin, out xmax, out ymax);/initialize the structure for the device boundaries deviceRect.bottom = ()ymax;deviceRect.left = ()xmin;d
10、eviceRect.top = ()ymin;deviceRect.right = ()xmax;/determine the visibounds of the currently pred pageIEnvelope visBounds = new EnvelopeClass();page.GetPageBounds(prer, m_CurrentPrPage, 0, visBounds);/get a handle to the graphics devicePtr hdc = e.Graphics.GetHdc();t the prpreview will be drawn to/pr
11、the page to the graphics device using the specified boundariesaxPageLayoontrol1.ActiveView.Output(hdc.To32(), dpi, ref deviceRect,visBounds, m_TrackCancel);/release the graphics device handle e.Graphics.ReleaseHdc(hdc);/check if furthages have to be predif (m_CurrentPrPage prPageCount)e.HasMorePages
12、 = true; /_PrPage event will be calledagainelsee.HasMorePages = false;最后添加单击事件打印设置:/Show the page setup dialog storing the result.DialogResult result = pageSetupDialog1.ShowDialog();/set the prer settings of the previewto the selected prer settings.PrerSettings = pageSetupDialog1.PrerSettings;/set t
13、he page settings of the previewto the selected page settings.DefaultPageSettings = pageSetupDialog1.PageSettings;/due to a bug in PageSetupDialog the Piterating through therSize has to be set explicitly by/available P rSizei;IEnumerator prSizeshe PageSetupDialog finding the selectedPrSizes =erSettin
14、gs.PpageSetupDialog1.PrrSizes.GetEnumerator();prSizes.Reset();for (i = 0; i pageSetupDialog1.PrerSettings.PrSizes.Count; +i)prSizes.MoveNext();if (PrSize)prSizes.Current).Kind =.DefaultPageSettings.PrSize.Kind).DefaultPageSettings.PrSizes.Current);rSize =(PrSize)p打印预览/initialize the currently pred p
15、age number m_CurrentPrPage = 0;/check if aif (axPageLayois loadedo PageLayoontrolontrol1.PageLayout = null) return;/set the name of the prpreviewto the name of the mxd doc.Name = axPageLayoontrol1.Filename;object/set the PrPreviewDialog. selected by the userprPreviewDperty to the Pr=;/show the dialog - this triggers theprPreviewDialog1.ShowDialog();s PrPage event打印输出prDialog1.AllowSomePages = true;/show the help button.prDialog1.ShowHelp = true;/set theproperty to the Prfor which the PrPage Event/has been handled. T
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024装修增加项目施工合同模板
- 个人经营贷款合同样本
- 2024建筑单包工合同范文
- 2024股份担保借款合同范本
- 2024个人住房公积金的借款合同
- 2024动产家具无偿寄托合同
- 房产项目合作开发协议书
- 三轮车买卖合同完整协议2024年
- 仓配租赁合同模板
- 工业用地投资协议
- 2024中国一汽校园招聘1000+岗位高频考题难、易错点模拟试题(共500题)附带答案详解
- GB/T 19533-2024汽车用压缩天然气钢瓶定期检验与评定
- 妇产科护士晋升述职报告
- 骨髓腔内输液(IOI)技术
- 建筑幕墙工程(铝板、玻璃、石材)监理实施细则(全面版)
- 小学数学与思政融合课教学设计
- 体育公园运营管理方案
- 休闲生态农业观光园建设项目财务分析及效益评价
- 江西省南昌市民德学校2023-2024学年八年级上学期期中数学试题
- 国际金融(英文版)智慧树知到期末考试答案2024年
- 2024年《药物临床试验质量管理规范》(GCP)网络培训题库
评论
0/150
提交评论