Article | 60000410 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 2/5/2008 |
Submitted by | Igor Gegusin |
Keywords |
Private Sub copy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles copy.Click Dim coloritem As VectorDraw.Professional.vdObjects.vdColor Dim cadfig As vdFigure Dim selset As vdSelection Dim docfrom As VectorDraw.Professional.vdObjects.vdDocument Dim docto As VectorDraw.Professional.vdObjects.vdDocument vdto.ActiveDocument.New() vdfrom.ActiveDocument.Open(Application.StartupPath() + "\PD-23-from.vdi", 0, 0) vdfrom.CommandAction.Zoom("e", 0, 0) ''create a temporary selection to add the entities you want to copy in destination document selset = vdfrom.ActiveDocument.Selections.Add("tmpCopy") selset.RemoveAll() For Each cadfig In vdfrom.ActiveDocument.Entities If cadfig.Visible = False Then Continue For selset.AddItem(cadfig) Next ''get the the VectorDraw FrameWork document objects. docfrom = vdfrom.ActiveDocument.WrapperObject docto = vdto.ActiveDocument.WrapperObject ''disable the undo write in destination document docto.UndoHistory.PushEnable(False) ''Use the MergeSelection to copy the entites and table dependecies from source to destination document docto.MergeSelection(selset.WrapperObject) ''Set the pallete and backround colors of destination same as the source document docto.Palette.Background = docfrom.Palette.Background docto.Palette.Forground = docfrom.Palette.Forground docto.Palette.RemoveAll() For Each coloritem In docfrom.Palette docto.Palette.AddItem(coloritem.Clone()) Next docto.Model.BkColorEx = docfrom.ActiveLayOut.BkColorEx ''pop back the undo mode of the destination to its original value. docto.UndoHistory.PopEnable() vdto.CommandAction.Zoom("e", 0, 0) vdto.ActiveDocument.SaveAs(Application.StartupPath() + "\PD-23-to.vdi", VdConstFileVer.DefaultVersion) End SubThe two VD controls are name vdfrom and vdto.