ae中實(shí)現(xiàn)設(shè)置、預(yù)覽_第1頁(yè)
ae中實(shí)現(xiàn)設(shè)置、預(yù)覽_第2頁(yè)
ae中實(shí)現(xiàn)設(shè)置、預(yù)覽_第3頁(yè)
ae中實(shí)現(xiàn)設(shè)置、預(yù)覽_第4頁(yè)
ae中實(shí)現(xiàn)設(shè)置、預(yù)覽_第5頁(yè)
已閱讀5頁(yè),還剩1頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

付費(fèi)下載

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、AE 中實(shí)現(xiàn)打印設(shè)置、打印預(yù)覽、打印輸出2012-05-27 10:10:14| 分類(lèi): AE 開(kāi)發(fā)筆記|字號(hào) 訂閱前提是已經(jīng)實(shí)現(xiàn)“數(shù)據(jù)視圖”與“版面視圖”的聯(lián)動(dòng)打印設(shè)置如下:打印預(yù)覽如下:打印輸出如下:主窗體內(nèi)添加字段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();主窗體函數(shù)中添加InitializePrPreviewDialog(); /initialize the prpreview dialogprDialog1 = new PrDialog(); /create a prdialog objectInitializePageSetupDialog(); /itialize the page setup dialog添加自定義函數(shù)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;最后添加單擊事件打印設(shè)置:/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打印預(yù)覽/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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論