Article | 60001534 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 11/9/2011 |
Submitted by | Luca Mancusi [Blumatica] |
Keywords |
vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; //Get the polyline with a method , I just take the last entity in my example where I know it is the clipping polyline. vdPolyline poly = doc.Model.Entities[vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.Count - 1] as vdPolyline; //Create a Layout and Add a viewport // vdLayout lay = new vdLayout(doc, "temp"); // you don't need to add the layout to the document. vdLayout lay = new vdLayout(); lay.SetUnregisterDocument(doc); lay.SetDocumentDefaults(); lay.DisableShowPrinterPaper = true; lay.BkColorEx = doc.Model.BkColorEx; vdViewport vport = new vdViewport(doc); vport.ClipObj = poly; //Set the viewport to show what we want. vport.ViewSize = poly.BoundingBox.Height; vport.ViewCenter = poly.BoundingBox.MidPoint; lay.Entities.AddItem(vport); lay.ZoomExtents(); //RenderToGraphics the layout that has only this viewport Bitmap bmp = null; bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics gr = Graphics.FromImage(bmp); lay.RenderToGraphics(gr, null, bmp.Width, bmp.Height); gr.Dispose(); //Show the Image in a pictureBox for debuging. pictureBox1.Image = bmp; pictureBox1.Update();