/// <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> /// This button specifies the insertion point of the block.The insertion point is added as a vdpoint with label "VD_TMP_ORIGIN" and this vdpoint is excluded when the block is saved and returned. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void butAddInsertionPoint_Click(object sender, EventArgs e) { gPoint userpoint; vdFramedControl1.BaseControl.ActiveDocument.Prompt("Select a Point:"); StatusCode ret = vdFramedControl1.BaseControl.ActiveDocument.ActionUtility.getUserPoint(out userpoint); vdFramedControl1.BaseControl.ActiveDocument.Prompt(null); if (ret == StatusCode.Success) { vdPoint pt = new vdPoint(); pt.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); pt.setDocumentDefaults(); pt.InsertionPoint = new gPoint(userpoint); pt.PenColor.SystemColor = Color.Red; pt.Label = "VD_TMP_ORIGIN"; vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(pt); vdFramedControl1.BaseControl.ActiveDocument.Redraw(true); butAddInsertionPoint.Enabled = false; } }