文檔金喜正規買球>>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微信公眾號 ???,了解產品的最新動態及最新資訊。