翻譯|使用教程|編輯:李顯亮|2020-09-25 10:20:48.343|閱讀 226 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會介紹如何為選擇集的第一個對象設置不同的突出顯示顏色。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導出。
點擊下載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(VDF),可以聯系咨詢相關問題。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn