翻譯|使用教程|編輯:黃竹雯|2018-12-12 16:10:56.000|閱讀 298 次
概述:本系列教程整理了VectorDraw 最常見問題,教程整理的很齊全,非常適合新手學習,希望對大家有一定的幫助!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導出。
【VectorDraw Developer Framework最新版下載】
VectorDraw web library (javascript)是一個矢量圖形庫。VectorDraw web library (javascript)不僅能打開CAD圖紙,而且能顯示任何支持HTML5標準平臺上的通用矢量對象,如Windows,安卓,iOS和Linux。無需任何安裝,VectorDraw web library (javascript)就可以運行在任何支持canvas標簽和Javascript的主流瀏覽器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。
【VectorDraw web library (javascript)最新版下載】
一. 通過單擊一個來選擇多個連續實體的方法
問:請問可以通過單擊一個來選擇多個連續實體的方法是什么?
答:由于圖中的實體沒有完全相互持續,并且其中一些實體存在一個小的“間隙”,因此你需要使用如下所示代碼:
vdFigure fig; gPoint pt; doc.Prompt("select a curve"); doc.ActionUtility.getUserEntity(out fig,out pt); doc.Prompt(null); vdCurve curve = fig as vdCurve; if(curve == null) return; gPoint sp = curve.getStartPoint(); gPoint ep = curve.getEndPoint(); vdSelection set = new vdSelection(); set.SetUnRegisterDocument(doc); set.AddItem(curve, true, vdSelection.AddItemCheck.RemoveInVisibleEntities); double equality = 0.01; int pos = 0; while (pos < set.Count && sp != null && ep != null) { gPoints pts = new gPoints(); pts.Add((sp - new gPoint(equality, equality))); pts.Add((sp + new gPoint(equality, equality))); set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts); pts = new gPoints(); pts.Add((ep - new gPoint(equality, equality))); pts.Add((ep + new gPoint(equality, equality))); set.Select(RenderSelect.SelectingMode.CrossingWindowRectangle, pts); pos++; sp = null; ep = null; for (int i = pos; i < set.Count; i++) { curve = set[i] as vdCurve; if (curve != null) { sp = curve.getStartPoint(); ep = curve.getEndPoint(); break; } pos++; } } doc.UndoHistory.StoreUndoGroup(true); foreach (vdFigure ent in set) { ent.PenColor = new vdColor(Color.Blue); ent.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_120; } doc.UndoHistory.StoreUndoGroup(false); set.Invalidate();
二. 使命令的行文本框接受空格鍵為enter
問:當我按下回車鍵并按空格鍵時,我想使命令行的行為相同。
答:你需要使用Command的行userText框事件KeyDown,并在按下空格時向其發送一條輸入消息,如下代碼所示:
void UserText_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Space) { VectorDraw.WinMessages.MessageManager.MSG m = new VectorDraw.WinMessages.MessageManager.MSG(); m.hwnd = vdFramedControl1.CommandLine.UserText.Handle; m.lParam = IntPtr.Zero; m.message = (int)VectorDraw.WinMessages.MessageManager.Messages.WM_KEYDOWN; m.wParam = (IntPtr)Keys.Enter; VectorDraw.WinMessages.MessageManager.TranslateMessage(ref m); VectorDraw.WinMessages.MessageManager.DispatchMessage(ref m); } } private void Form1_Load(object sender, EventArgs e) { vdFramedControl1.CommandLine.UserText.KeyDown += new KeyEventHandler(UserText_KeyDown); }
三. 在cmdText啟動之前設置文本的高度
問:文檔的全局/默認文本高度是否存在?我想要這個,因為當我想從用戶輸入高度值時,它在用戶創建此vdtext時不會影響當前的vdtext。當用戶按照你在先前郵件中的建議完成命令時,高度會生效。但我希望用戶在撰寫文本時可以看到新的高度。
答:你可以在cmdText啟動之前設置文本的高度。請參閱下面的代碼和備注:
private void button3_Click(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; doc.New(); cmdTextWithHeight(doc, null, null, null, 5.0); cmdTextWithHeight(doc, "VDF version6", new gPoint(30,30), null, 15.0); cmdTextWithHeight(doc, null, new gPoint(10,10), 0.0d, 25.0); cmdTextWithHeight(doc, "hi", null, 30.0, 35.0); } private bool cmdTextWithHeight(vdDocument document, object TextString, object InsertionPoint, object RotationAngle, double TextHeight) { bool ret = false; double oldheight = document.ActiveTextStyle.Height; // store the old value to set this back after this finishes document.ActiveTextStyle.Height = TextHeight;// set the Height that is needed to activetextstyle if (document.CommandAction.CmdText(TextString, InsertionPoint, RotationAngle)) { vdText txt = document.ActiveLayOut.Entities[document.ActiveLayOut.Entities.Count - 1] as vdText; // get the text that was just created if (txt != null) { //... do other things there with the just-created-vdText if you like !! txt.Height = TextHeight; // see it to the Height so evene if activeTextStyle changes this remains. ret = true; } } document.ActiveTextStyle.Height = oldheight; // set the original value back. return ret; }
未完待續~
*點擊圖片查看活動詳情*
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn