翻譯|使用教程|編輯:況魚杰|2019-11-04 14:40:52.520|閱讀 193 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會介紹如何在不損失軟件邊距的情況下將繪圖集中在紙張上。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何在不損失軟件邊距的情況下將繪圖集中在紙張上。CenterDrawingToPaper方法將所有軟件邊距設置為0并重新計算,這個原因?qū)е挛覠o法使用它。
答:
您需要像以前一樣設置邊距,然后排列PrintWindow和/或PrintScale。
具體的請參見以下代碼:
doc.New(); vdLayout layout = doc.LayOuts.Add("test"); doc.ActiveLayOut = layout; layout.Entities.AddItem(new vdRect(doc, new gPoint(-100, 0), 150, 150, 0)); layout.Printer.margins = new MARGINS(50, 50, 50, 50); layout.Printer.paperSize = new Rectangle(0, 0, 827, 1169); layout.Printer.PrintScale = new PrinterScale(1, 1); layout.Printer.PrinterName = "c:\\test.pdf"; layout.Printer.PrintWindow = new Box(new gPoint(-100, 0), new gPoint(-100 + 150, 150)); doc.ZoomAll(); doc.Redraw(true); doc.Prompt("press any key to continue"); doc.ActionUtility.getUserString(); doc.Prompt(null);// just to create something on screen //get a clone of selected printer window in Drawing Units Box printwindowDU =new Box( layout.Printer.PrintWindow); gPoint mid = printwindowDU.MidPoint; //calculate the printable paper area in drawing Units relative to the Layout // convert printer hinches to drawing units depend of printer scale double PrinterHInch2DUScale = (Globals.INCH_MM / 100.0f) * (layout.Printer.PrintScale.Denumerator / layout.Printer.PrintScale.Numerator); //Get the rectanle in Drawing Units of Current View for the selected printer paper without the hard Margins. Box printableAreaDU = layout.Printer.PrintablePaperDU(); //Subtract from the paper the the selected soft margins double printableAreaDU_Width = printableAreaDU.Width - (layout.Printer.margins.Left + layout.Printer.margins.Right) * PrinterHInch2DUScale; double printableAreaDU_Height = printableAreaDU.Height - (layout.Printer.margins.Top + layout.Printer.margins.Bottom) * PrinterHInch2DUScale; //Center the printWindow to the paper. //Calculate the new printer PrintWindow to be center to paper area by keeping its center and change the width and height to be equal to printable area. Box newPrintWindow = new Box(mid + new gPoint(-printableAreaDU_Width*0.5,-printableAreaDU_Height*0.5),mid + new gPoint(printableAreaDU_Width*0.5,printableAreaDU_Height*0.5)); layout.Printer.PrintWindow = newPrintWindow; layout.Printer.Update(); doc.Redraw(true);
對于以上問答,如果您有任何的疑惑都可以在評論區(qū)留言,我們會及時回復。此系列的問答教程我們會持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
如果您對想要購買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問題。
關(guān)注慧聚IT微信公眾號 ???,了解產(chǎn)品的最新動態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: