Article | 60001591 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 1/4/2012 |
Submitted by | Bruce Jacobs |
Keywords |
private void button3_Click(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; vdLayout lay = new vdLayout(doc, "BBB"); doc.LayOuts.AddItem(lay); vdViewport vp = new vdViewport(); vp.SetUnRegisterDocument(doc); vp.setDocumentDefaults(); vp.Height = doc.Model.ViewSize / doc.Model.PixelSize; vp.Width = vdFramedControl1.BaseControl.Width; vp.Center = new gPoint(vp.Width/2.0, vp.Height / 2.0d); vdView viewTMP = new vdView(doc, "mYvIEW1"); viewTMP.SetFromLayout(doc.Model); vp.SetFromView(viewTMP);// viewTMP is not necessary to be // added to the document in such occasions // or by hard code, without using the vdView object like : //vp.World2ViewMatrix = new Matrix(doc.Model.World2ViewMatrix); //vp.ViewCenter = new gPoint(doc.Model.ViewCenter); //vp.ViewSize = doc.Model.ViewSize; //vp.RenderMode = doc.Model.RenderMode; // set also PerspectiveMod,LensAngle, FocalLength etc if you use them lay.Entities.AddItem(vp); if (vp.Height < vp.Width) lay.Printer.LandScape = true; lay.Printer.PrintExtents(); lay.Printer.PrintScaleToFit(); lay.Printer.Update(); lay.Update(); doc.ActiveLayOut = lay; doc.CommandAction.Zoom("E", 0, 0); }