VDF常見(jiàn)問(wèn)題整理(三十二):忽略片段的對(duì)象
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問(wèn):
是否有可能使用像vdInsert這樣的對(duì)象來(lái)忽略節(jié)剪輯?我希望圖形上的所有其他對(duì)象都可以通過(guò)部分剪切來(lái)剪切,但不希望通過(guò)此vdInsert來(lái)剪切。我怎樣才能做到這一點(diǎn)?
答:
您可以使用vdRender對(duì)象和ClearAllSectionClips / ApplySectionClips方法來(lái)執(zhí)行此操作,請(qǐng)參見(jiàn)下面的代碼:
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
對(duì)于以上問(wèn)答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問(wèn)答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門(mén)文章推薦:
如果您對(duì)想要購(gòu)買(mǎi)正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系在線客服>>咨詢相關(guān)問(wèn)題。
關(guān)注慧聚IT微信公眾號(hào) ???,了解產(chǎn)品的最新動(dòng)態(tài)及最新資訊。