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; }
以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
-
如何排除GroundSurface对象的三角形区域/span>
-
复杂自定义对象的入门指南
=======================================================
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!