版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026西安市汉长安城遗址保管所讲解员招聘农业考试备考题库及答案解析
- 2026贵州安顺经开区劳保局招聘公益性岗位人员1人农业考试参考题库及答案解析
- 2026四川遂宁射洪市涪西镇卫生院(射洪市涪西镇医养结合服务中心)招聘13人农业考试参考题库及答案解析
- 2026年湖南省生态环境厅所属事业单位选调3人农业考试参考题库及答案解析
- 2026重庆巫溪县古路镇卫生院招聘见习生农业笔试备考试题及答案解析
- 2026安徽阜阳临泉县中医院养护中心(护理公司)护理员招聘20人农业笔试模拟试题及答案解析
- 2026浙江杭州萧山区招聘幼儿园合同制教师132人农业考试参考题库及答案解析
- 2026年齐齐哈尔甘南县公益性岗位人员招聘2人农业考试备考题库及答案解析
- 2026云南红河州个旧市大红屯粮食购销有限公司第一次社会招聘9人农业考试备考试题及答案解析
- 2026浙江杭州市上城区采荷街道社区卫生服务中心上半年编外工作人员招聘2人农业考试备考题库及答案解析
- 林业调查安全培训
- 2024-2025学年江苏省泰州市兴化市四校高二下学期4月期中联考数学试题(解析版)
- 2025年江西省从“五方面人员”中选拔乡镇领导班子成员考试历年参考题库含答案详解(5套)
- 2025年11月济南轨道交通集团运营有限公司社会招聘笔试参考题库附带答案详解(10套)
- 2025年杭州银行笔试题库及答案
- 2025年北京市中考数学真题试卷及答案
- 120急救站工作汇报
- 义警规章管理制度
- 广东省高州市全域土地综合整治项目(一期)可行性研究报告
- 教育事业十五五发展规划
- T/CNPPA 3017-2021塑料和橡胶类药包材自身稳定性研究指南
评论
0/150
提交评论