VDF常见问题整理(三十二):忽略片段的对象

VectorDraw Developer Framework试用版下载


问:

    是否有可能使用像vdInsert这样的对象来忽略节剪辑希望图形上的所有其他对象都可以通过部分剪切来剪切,但不希望通过此vdInsert来剪切。我怎样才能做到这一点/p>

答:

    您可以使用vdRender对象和ClearAllSectionClips / ApplySectionClips方法来执行此操作,请参见下面的代码:

vdInsert clip_ins = null; // will be used to check the object that will not have section clips applied for itISectionClips sectionclips = null; // will be used to restore the section clips laterprivate void button10_Click(object sender, EventArgs e){    vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;    doc.Open(@"C:testSEC_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

    对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。

热门文章推荐:

  • 如何排除GroundSurface对象的三角形区域/strong>

  • 复杂自定义对象的入门指南


    如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。


标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年10月1日
下一篇 2019年10月1日

相关推荐

发表回复

登录后才能评论