翻譯|使用教程|編輯:況魚杰|2019-11-28 13:42:56.170|閱讀 214 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見(jiàn)問(wèn)題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會(huì)展示如何突出顯示vdInsert,將會(huì)有一個(gè)例子演示如何操作。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問(wèn):
如果想要實(shí)現(xiàn)當(dāng)將鼠標(biāo)懸停在一些元素上時(shí),它們突出顯示,或者是能夠在內(nèi)部繪制陰影線。這能夠?qū)崿F(xiàn)嗎?當(dāng)然,也有可能不可能實(shí)現(xiàn),因?yàn)檫@是vdInsert而不是像rect這樣的標(biāo)準(zhǔn)形狀。
答:
突出顯示Insert對(duì)象是無(wú)法實(shí)現(xiàn)的,但是我們可以以塊的邊界框的大小創(chuàng)建一個(gè)新的矩形,而不是突出顯示該矩形。
下面是一個(gè)使用AddBlockFromFile(ccc.vds)方法加載vds文件并創(chuàng)建一個(gè)新塊(aaa)的示例,之后我們調(diào)用vdmousemove和vdmouseout方法,當(dāng)光標(biāo)在包含該塊的矩形上方時(shí),需要依次調(diào)用該vdmousemove和vdmouseout方法,然后將該矩形突出顯示。當(dāng)光標(biāo)移出該矩形區(qū)域之外時(shí),使用vdmouseout方法 將不再突出顯示。
以下是操作演示圖:
以下是操作代碼:
var lastSelectedEntity = null;//Keep the entity in a variable function _vdmousemove(e) { if (vdcanvas.ActiveAction().IsStarted()) return;// We check tha action in case another action has been started var entity = e.target.GetEntityFromPoint(e.xPix, e.yPix);// Found the entity above the cursor if (entity == lastSelectedEntity) return; lastSelectedEntity = entity; if (entity != null && entity._t == vdConst.vdInsert_code && entity.BlockRef && entity.BlockRef.Name == "aaa") {//if the entity is the block that we want var minpt = [entity.BoundingBox[0], entity.BoundingBox[1], entity.BoundingBox[2]];//The lowest left corner of the boundingBox var maxpt = [entity.BoundingBox[3], entity.BoundingBox[4], entity.BoundingBox[5]]; //The upper right corner of the boundingBox var rect = vdcanvas.AddRect(minpt, maxpt, false, {});//We draw a rectangle in the size of the bounding box of the block //rect.HatchProperties = vdcanvas.createNewHatchProperties("solid", vdConst.colorFromString("byblock"), vdConst.colorFromString("255,0,0,50")); rect.HatchProperties = vdcanvas.createNewHatchProperties("u20", vdConst.colorFromString("255,255,255,50"), vdConst.colorFromString("255,255,255,255"), 1, vdgeo.DegreesToRadians(45));//We add hatch properties to the rect vdcanvas.Refresh(); vdcanvas.ActionDrawEntities([rect]);//We draw the rect } else { vdcanvas.ActionDrawEntities(null); } } function _vdmouseout(e) {//Incase cursor is out of the canvas if (!lastSelectedEntity) return; lastSelectedEntity = null; vdcanvas.ActionDrawEntities(null); } function test() { var blk = vdcanvas.AddBlockFromFile("ccc.vds", "aaa", true);//We load the block from ccc.vds vdcanvas.AddBlockSymbol("aaa", [0, 0, 0], 1, 0, true, null);//We draw the block vdcanvas.zoomExtents(); vdcanvas.redraw(); vdcanvas.vdmousemove = _vdmousemove; vdcanvas.vdmouseout = _vdmouseout;//Incase cursor is out of the canvas }
對(duì)于以上問(wèn)答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問(wèn)答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guā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)載自: