翻譯|使用教程|編輯:況魚杰|2019-11-06 10:34:57.647|閱讀 252 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會(huì)介紹如何選定實(shí)體的用戶操作。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何選定實(shí)體的用戶操作?
答:
為了選擇許多圖形并對(duì)其進(jìn)行處理,請(qǐng)參見以下代碼:
//Set the section window colors.It is not important but help the user for selecting. vdcanvas.SetActionFillColor(new Array(0, 0, 255, 100));// fill color for simple window select, from left to right // ( select only entities completely inside rectangle). vdcanvas.SetActionCrossFillColor(new Array(0, 255, 0, 100));//fill color for crossing window select ,from right to left // (select entities that are inside or intersect rectangle). //begin a selection action //If a user pick to a point with no entity a new window select will open //continue add entities until command cancel by right click // -or- // a vdcanvas.ActiveAction.cancel(); method is called by your application //Selected entities are drawn with Red color //cmdselectCallback a callback function that is fire when the selection is successfully finished. vdcanvas.CmdSelect(_cmdselectCallback); //Is fired when selection successfully finished function _cmdselectCallback(action) { //enum all selected entities if (!action.customData || action.customData.length == 0) return; for (var k = 0; k < action.customData.length; k++) { var fig = action.customData[k];//get the selected figure //do something with figure like hightlight it fig.HighLight = true; } action.vdrawOwner().redraw(); } In order select a single figure see following code: vdcanvas.PickSize = 8;// 8 pixel wide vdcanvas.GetUserPoint(_onActionPointIdStateChanged); // prompts the user to pick a point on the control and fire the // _onActionPointIdStateChanged when the action finsh or cancel function _onActionPointIdStateChanged(action, status) { var vdcanvas = action.vdrawOwner(); if (status == 'start') { vdcanvas.Prompt('pick a point'); } else if (status == 'end') { if (!action.IsCanceled()) { //vdcanvas.Prompt('X= ' + action.ResValue[X].toString() + ' Y= ' + action.ResValue[Y].toString()); var p1 = vdcanvas.WorldToPixel(action.ResValue); //transorm the passed action point from world to pixel var fig = vdcanvas.GetEntityFromPoint(p1[X], p1[Y]); //get the last drawn entity passing throw a pick box //with center the p1 and size define by vdcanvas.PickSize if (fig) { //do somthing with selected figure //for example mark as highlight and re-draw it fig.HighLight = true; //redraw a single entity procedure vdcanvas.UpdateFig(fig); vdcanvas.DrawEntity(fig); vdcanvas.Refresh(); vdcanvas.Prompt(String(fig.HandleId) + " selected");//display the selected figure handle } } else { vdcanvas.Prompt(''); } } }
對(duì)于以上問答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
如果您對(duì)想要購(gòu)買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guā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)載自: