彩票走势图

logo VectorDraw Developer Framework使用教程
文档彩票走势图>>VectorDraw Developer Framework使用教程>>VDF常见问题整理(五十七):如何多种突出显示颜色

VDF常见问题整理(五十七):如何多种突出显示颜色


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),可以联系咨询相关问题。

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP