翻譯|使用教程|編輯:況魚杰|2019-09-27 15:38:01.923|閱讀 281 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問(wèn)題,教程整理的很齊全,非常適合新手學(xué)習(xí),本節(jié)教程將會(huì)介紹如何在折線上創(chuàng)建新頂點(diǎn)并單擊來(lái)移動(dòng)它。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
點(diǎn)開本篇文章,是否對(duì)矢量圖形工具感興趣呢?來(lái)看看最新的矢量圖形工具測(cè)評(píng)吧!點(diǎn)擊此處>>即可直達(dá)哦!
問(wèn):
我正在嘗試添加一個(gè)函數(shù),用戶可以在按住Shift的同時(shí)單擊多段線上的一點(diǎn),在該點(diǎn)處添加新頂點(diǎn),并且拖動(dòng)操作立即開始。我怎樣才能做到這一點(diǎn) ?
答:
使用InsertAt在折線的VertexList中添加一個(gè)點(diǎn),并使用cmdMoveGripPoints開始移動(dòng)新添加的夾點(diǎn)。代碼如下所示:
using VectorDraw.Professional.vdObjects; using VectorDraw.Professional.vdFigures; using VectorDraw.Geometry; using VectorDraw.Professional.vdCollections; using VectorDraw.Professional.vdPrimaries; using System.Runtime.InteropServices; using VectorDraw.Professional.ActionUtilities; using VectorDraw.Generics; ....... ....... [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern short GetAsyncKeyState(int vkey); // see // //msdn.microsoft.com/en-us/library/windows/desktop/ms646293%28v=vs.85%29.aspx void BaseControl_vdMouseDown(MouseEventArgs e, ref bool cancel) { gPoint pos = doc.CCS_CursorPos(); gPoint p1 = doc.World2PixelMatrix.Transform(pos as gPoint); Point location1 = new Point((int)p1.x, (int)p1.y); vdFigure fig10 = doc.ActiveLayOut.GetEntityFromPoint(location1, 10, false); if (fig10 is vdPolyline) { if (GetAsyncKeyState((int)Keys.ShiftKey) < 0) { //add a vertex after the segment index vdPolyline tmp = (vdPolyline)fig10 as vdPolyline; int vertIDX = tmp.SegmentIndexFromPoint(pos, 1); tmp.VertexList.InsertAt(vertIDX + 1, new Vertex(pos)); tmp.Update(); tmp.Invalidate(); vdSelection sel = new VectorDraw.Professional.vdCollections.vdSelection(); sel.SetUnRegisterDocument(doc); Box box = new Box(); box.AddPoint(doc.Model.View2WorldMatrix.Transform(pos)); box.AddWidth(doc.GlobalRenderProperties.GripSize * doc.ActiveRender.PixelSize / 2.0d); sel.AddItem(tmp, false,vdSelection.AddItemCheck.Nochecking, true); Int32Array indexes = doc.Model.getGripIndexes(tmp, box); VectorDraw.Generics.vdArrayindexesArray = new vdArray(); indexesArray.AddItem(indexes); VectorDraw.Actions.BaseAction movegrips = new CmdMoveGripPoints(pos, doc.ActiveLayOut, sel, indexesArray); doc.ActionAdd(movegrips); VectorDraw.Actions.StatusCode ret = movegrips.WaitToFinish(); string retStr = ret.ToString(); //MessageBox.Show("Action cmdMoveGripPoints ended with result : " + retStr + // " . new vertex is now : " + pos.ToString()); cancel = true; } } }
對(duì)于以上問(wèn)答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問(wèn)答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
如何排除GroundSurface對(duì)象的三角形區(qū)域?
點(diǎn)擊此處還有VectorDraw Developer Framework的demo示例等著你來(lái)體驗(yàn)哦!
如果您對(duì)想要購(gòu)買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問(wèn)題。
關(guān)注慧聚IT微信公眾號(hào) ???,了解產(chǎn)品的最新動(dòng)態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: