




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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年河北省隆化县人民医院公开招聘护理工作人员试题带答案详解
- 洪洞教编初中数学试卷
- 医院项目管理课件
- 医院课件教学课件
- 《网络综合布线》教案 项目3实训任务 实施工程预算和撰写采购招标文件
- 健康管理中心课件内容
- 中国无线鼠标行业发展监测及投资战略规划研究报告
- 2021-2026年中国风光互补控制器市场竞争格局及投资战略规划报告
- 2025-2030年中国制动鼓行业市场供需态势及发展前景研判报告
- 中国无糖糖果行业市场发展监测及投资潜力预测报告
- 2023-2024学年深圳市盐田区数学四下期末学业水平测试试题含解析
- 虚拟股权激励方案(模板)
- 2024-2029年中国管道运输行业发展分析及发展前景与投资研究报告
- 泰文租房合同
- 建筑维修与保养方法
- 金华出租车从业资格证模拟考试题
- (完整)中医症候积分量表
- 劳务外包三方协议
- 水果礼盒创业计划书
- 水产养殖行业营销策略方案
- 厂房分布式光伏系统施工进度计划横道图
评论
0/150
提交评论