翻譯|使用教程|編輯:況魚杰|2019-10-08 10:08:59.953|閱讀 200 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習,本章將會介紹當想要突出顯示選中的對象時,如何才能為選擇集的第一個對象設置不同的突出顯示顏色的代碼。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
點開本篇文章,是否對矢量圖形工具感興趣呢?來看看最新的矢量圖形工具測評吧!點擊此處>>即可直達哦!
問:
如何才能突出顯示顏色?當想要突出顯示選中的對象時,如何才能為選擇集的第一個對象設置不同的突出顯示顏色?
答:
此問題只能在OnDrawFigure事件中完成,在該事件中,您可以檢查選定對象是否在臨時選擇中,在這種情況下,請使用其他顏色替換該對象,例如:
private void button1_Click(object sender, EventArgs e) { vdDocument doc = vdFramed1.BaseControl.ActiveDocument; doc.FreezeEntityDrawEvents.Push(false); //Enable draw events doc.OnDrawFigure+=new vdDocument.FigureDrawEventHandler(doc_OnDrawFigure); //add the event andler } void doc_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel) { if (sender == null) return; vdDocument doc = vdFramed1.BaseControl.ActiveDocument; vdSelection selected = doc.Selections.FindName("VDRAW_TEMPORARY_SELSET"); // get the selection that contains the items if (selected == null || selected.Count < 1) return; vdFigure fig = sender as vdFigure; if (fig==null) return; if (selected.FindItem(fig)) // if the fig is in this selection (is selected) { double pix_size = render.PixelSize; if (ReferenceEquals(fig, selected[0])) { // push a different color to the render if this object is the first selected render.PushPenstyle(Color.Red, 4*pix_size); } else { render.PushPenstyle(Color.Yellow, 1*pix_size); } doc.FreezeEntityDrawEvents.Push(true); // disable the event as fig.Draw() will make it fire again fig.Draw(render); // draw the object with the penstyle pushed before doc.FreezeEntityDrawEvents.Pop(); // pop the event..... ALL PUSH must be followed by POP render.PopPenstyle(); //pop the penstyle ..... ALL PUSH must be followed by POP cancel = true; // do not allow vdraw to draw this item it is already draw by fig.Draw() above } else cancel = false; }
熱門文章推薦:
點擊此處還有VectorDraw Developer Framework的demo示例等著你來體驗哦!
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯系咨詢相關問題。
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: