文档半岛外围网上直营>>VectorDraw Developer Framework使用教程>>VDF常见问题整理(三十二):忽略片段的对象
VDF常见问题整理(三十二):忽略片段的对象
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw Developer Framework试用版下载
问:
是否有可能使用像vdInsert这样的对象来忽略节剪辑?我希望图形上的所有其他对象都可以通过部分剪切来剪切,但不希望通过此vdInsert来剪切。我怎样才能做到这一点?
答:
您可以使用vdRender对象和ClearAllSectionClips / ApplySectionClips方法来执行此操作,请参见下面的代码:
vdInsert clip_ins = null; // will be used to check the object that will not have section clips applied for it
ISectionClips sectionclips = null; // will be used to restore the section clips later
private void button10_Click(object sender, EventArgs e)
{
vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;
doc.Open(@"C:\test\SEC_clip.vdml");// use your path here to open a test drawing that contains the vdInsert and section clips
doc.CommandAction.Zoom("W", new gPoint(-2,-2), new gPoint(30,30));
clip_ins = doc.Model.Entities[1] as vdInsert; // this is the vdInsert that will ignore section clipping
if (clip_ins == null) return; // this is the vdInsert that defines the section clipping !
doc.FreezeEntityDrawEvents.Push(false);
doc.FreezeModifyEvents.Push(false);
doc.OnDrawFigure += new vdDocument.FigureDrawEventHandler(doc_OnDrawFigure); // these two events are necessary
doc.OnDrawAfterFigure += new vdDocument.FigureAfterDrawEventHandler(doc_OnDrawAfterFigure);
}
void doc_OnDrawAfterFigure(object sender, VectorDraw.Render.vdRender render)
{
if (sender != null && sender == clip_ins) // re-enable section clips for this vdInsert
{
render.ApplySectionClips(sectionclips); // using the stored section clips from DrawFigure event
}
}
void doc_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel)
{
if (sender != null && sender == clip_ins)// disable section clips for this vdInsert
{
sectionclips = render.SectionClips; // keep the section clips for the DrawAfterFigure to be re-enabled
render.ClearAllSectionClips(); // and clear them
}
}//end 对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系咨询相关问题。
关注慧聚IT微信公众号 ???,了解产品的最新动态及最新资讯。


QQ交谈
在线咨询

渝公网安备
50010702500608号

客服热线