/// <summary> /// Initializes the dialog. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditCreateBlock_Load(object sender, EventArgs e) { vdFramedControl1.BaseControl.ActiveDocument.New(); if (mblk == null) { textName.Text = ""; butAddInsertionPoint.Enabled = true; } else { textName.Text = mblk.Name; butAddInsertionPoint.Enabled = false; vdBlock block = new vdBlock(); block.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); block.setDocumentDefaults(); block.MatchProperties(mblk, vdFramedControl1.BaseControl.ActiveDocument); vdFramedControl1.BaseControl.ActiveDocument.Blocks.AddItem(block); vdInsert ins = new vdInsert(); ins.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); ins.setDocumentDefaults(); ins.Block = block; vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(ins); vdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdExplode(ins); ins.Deleted = true; vdPoint pt = new vdPoint(); pt.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); pt.setDocumentDefaults(); pt.InsertionPoint = new gPoint(); pt.PenColor.SystemColor = Color.Red; pt.Label = "VD_TMP_ORIGIN"; vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(pt); vdFramedControl1.BaseControl.ActiveDocument.CommandAction.Zoom("E", 0, 0); vdFramedControl1.BaseControl.ActiveDocument.CommandAction.Zoom("S", 0.95, 0); vdFramedControl1.BaseControl.ActiveDocument.Redraw(true); } vdFramedControl1.BaseControl.ActiveDocument.OnUndoStoreValue += new vdDocument.UndoStoreValueEventHandler(ActiveDocument_OnUndoStoreValue); //LOAD EditBlocksCOMMANDS / EditBlocksMENU vdFramedControl1.UnLoadCommands(); vdFramedControl1.UnLoadMenu(); vdFramedControl1.LoadCommands(GetResourcesPath(), "BlockLibraryCommands.txt"); vdFramedControl1.LoadMenu(GetResourcesPath(), "BlockLibraryMenu.txt"); vdFramedControl1.ShowMenu(true); }
/// <summary> /// Draws to the preview component the block indicated by the parameter. /// </summary> /// <param name="selectedname">The name of the block to be displayed.</param> private void DrawPreview(string selectedname) { this.vectorDrawBaseControl1.ActiveDocument.Model.Entities.RemoveAll(); if (selectedname != null && selectedname != "") { this.vectorDrawBaseControl1.ActiveDocument.Palette.Background = mdoc.Palette.Background; vdInsert ins = new vdInsert(); ins.SetUnRegisterDocument(vectorDrawBaseControl1.ActiveDocument); ins.setDocumentDefaults(); ins.Block = vectorDrawBaseControl1.ActiveDocument.Blocks.FindName(selectedname); vectorDrawBaseControl1.ActiveDocument.Model.Entities.AddItem(ins); vectorDrawBaseControl1.ActiveDocument.CommandAction.Zoom("E", 0, 0); vectorDrawBaseControl1.ActiveDocument.CommandAction.Zoom("S", 0.95, 0); } vectorDrawBaseControl1.ActiveDocument.Redraw(true); }