Esempio n. 1
0
 protected override void OnEditValueChanged()
 {
     if (base.EditValue != null)
     {
         object[] items = base.Items;
         //this.vsPropertyGrid1.Site = new CollectionEditor.PropertyGridSite(base.Context, this.vsPropertyGrid1);
         NodeViewItem[] nodes = new NodeViewItem[items.Length];
         for (int i = 0; i < items.Length; i++)
         {
             nodes[i] = (NodeViewItem)((NodeViewItem)items[i]).Clone();
         }
         this.treeView1.NodeViewItems.Clear();
         //foreach (NodeViewItem one in this.treeView1.NodeViewItems)
         foreach (NodeViewItem one in nodes)
         {
             this.treeView1.NodeViewItems.Add(one);
         }
         this.m_CurrentNode       = null;
         this.btnAddChild.Enabled = false;
         this.btnDelete.Enabled   = false;
         NodeViewItemTreeItem treeView = this.TreeView;
         if ((items.Length > 0) && (nodes[0] != null))
         {
             this.treeView1.SelectedNode = nodes[0];
         }
     }
 }
Esempio n. 2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     object[] objArray = new object[this.treeView1.NodeViewItems.Count];
     for (int i = 0; i < objArray.Length; i++)
     {
         objArray[i] = this.treeView1.NodeViewItems[i].Clone();
     }
     base.Items = objArray;
     this.treeView1.Dispose();
     this.treeView1 = null;
 }
Esempio n. 3
0
 private void InitializeComponent()
 {
     this.tlpOkAndCancel  = new TableLayoutPanel();
     this.btnOk           = new System.Windows.Forms.Button();
     this.btnCancel       = new System.Windows.Forms.Button();
     this.tlpAddNode      = new System.Windows.Forms.TableLayoutPanel();
     this.btnAddRoot      = new GISShare.Controls.WinForm.VsButton(this.m_Editor.CreateNewItemTypes().Length > 1);
     this.btnAddChild     = new GISShare.Controls.WinForm.VsButton(this.m_Editor.CreateNewItemTypes().Length > 1);
     this.btnDelete       = new System.Windows.Forms.Button();
     this.btnMoveDown     = new System.Windows.Forms.Button();
     this.btnMoveUp       = new System.Windows.Forms.Button();
     this.vsPropertyGrid1 = new GISShare.Controls.WinForm.VsPropertyGrid(base.Context);
     this.lblRight        = new System.Windows.Forms.Label();
     this.treeView1       = new NodeViewItemTreeItem();
     this.baseItemHost1   = new BaseItemHost();
     this.lblLeft         = new System.Windows.Forms.Label();
     this.tlpAll          = new System.Windows.Forms.TableLayoutPanel();
     this.tlpMoveDelete   = new System.Windows.Forms.TableLayoutPanel();
     this.tlpOkAndCancel.SuspendLayout();
     this.tlpAddNode.SuspendLayout();
     this.tlpAll.SuspendLayout();
     this.tlpMoveDelete.SuspendLayout();
     base.SuspendLayout();
     //
     // contextMenuStrip1
     //
     this.contextMenuStrip1      = new ContextMenuStrip();
     this.contextMenuStrip1.Name = "contextMenuStrip1";
     this.contextMenuStrip1.Text = "contextMenuStrip1";
     //
     // okCancelPanel
     //
     this.tlpOkAndCancel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 63.59447F));
     this.tlpOkAndCancel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 36.40553F));
     this.tlpOkAndCancel.Controls.Add(this.btnOk, 0, 0);
     this.tlpOkAndCancel.Controls.Add(this.btnCancel, 1, 0);
     this.tlpOkAndCancel.Dock     = System.Windows.Forms.DockStyle.Right;
     this.tlpOkAndCancel.Location = new System.Drawing.Point(412, 300);
     this.tlpOkAndCancel.Margin   = new System.Windows.Forms.Padding(3, 3, 13, 13);
     this.tlpOkAndCancel.Name     = "tlpOkAndCancel";
     this.tlpOkAndCancel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpOkAndCancel.Size     = new System.Drawing.Size(217, 23);
     this.tlpOkAndCancel.TabIndex = 6;
     //
     // btnOk
     //
     this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.btnOk.Dock         = System.Windows.Forms.DockStyle.Right;
     this.btnOk.Location     = new System.Drawing.Point(60, 0);
     this.btnOk.Margin       = new System.Windows.Forms.Padding(0, 0, 3, 0);
     this.btnOk.Name         = "btnOk";
     this.btnOk.Size         = new System.Drawing.Size(75, 23);
     this.btnOk.TabIndex     = 0;
     this.btnOk.Text         = "确定";
     //
     // btnCancel
     //
     this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.btnCancel.Dock         = System.Windows.Forms.DockStyle.Right;
     this.btnCancel.Location     = new System.Drawing.Point(142, 0);
     this.btnCancel.Margin       = new System.Windows.Forms.Padding(3, 0, 0, 0);
     this.btnCancel.Name         = "btnCancel";
     this.btnCancel.Size         = new System.Drawing.Size(75, 23);
     this.btnCancel.TabIndex     = 1;
     this.btnCancel.Text         = "取消";
     //
     // tlpAddNode
     //
     this.tlpAddNode.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tlpAddNode.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tlpAddNode.Controls.Add(this.btnAddChild, 1, 0);
     this.tlpAddNode.Controls.Add(this.btnAddRoot, 0, 0);
     this.tlpAddNode.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tlpAddNode.Location = new System.Drawing.Point(13, 265);
     this.tlpAddNode.Margin   = new System.Windows.Forms.Padding(13, 3, 3, 3);
     this.tlpAddNode.Name     = "tlpAddNode";
     this.tlpAddNode.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpAddNode.Size     = new System.Drawing.Size(283, 29);
     this.tlpAddNode.TabIndex = 5;
     //
     // btnAddRoot
     //
     this.btnAddRoot.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.btnAddRoot.Location = new System.Drawing.Point(154, 3);
     this.btnAddRoot.Margin   = new System.Windows.Forms.Padding(3, 3, 13, 3);
     this.btnAddRoot.Name     = "btnAddRoot";
     this.btnAddRoot.Size     = new System.Drawing.Size(126, 23);
     this.btnAddRoot.TabIndex = 0;
     this.btnAddRoot.Text     = "添加根(&R)";
     //
     // btnAddChild
     //
     this.btnAddChild.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.btnAddChild.Location = new System.Drawing.Point(3, 3);
     this.btnAddChild.Margin   = new System.Windows.Forms.Padding(13, 3, 3, 3);
     this.btnAddChild.Name     = "btnAddChild";
     this.btnAddChild.Size     = new System.Drawing.Size(125, 23);
     this.btnAddChild.TabIndex = 1;
     this.btnAddChild.Text     = "添加子级(&C)";
     //
     // btnDelete
     //
     this.btnDelete.Image    = new System.Drawing.Bitmap(this.GetType().Assembly.GetManifestResourceStream("GISShare.Controls.WinForm.Image.Delete.bmp"));
     this.btnDelete.Location = new System.Drawing.Point(0, 53);
     this.btnDelete.Margin   = new System.Windows.Forms.Padding(0, 3, 0, 0);
     this.btnDelete.Name     = "btnDelete";
     this.btnDelete.Size     = new System.Drawing.Size(28, 23);
     this.btnDelete.TabIndex = 1;
     //
     // btnMoveDown
     //
     this.btnMoveDown.Image    = new System.Drawing.Bitmap(this.GetType().Assembly.GetManifestResourceStream("GISShare.Controls.WinForm.Image.MoveDown.bmp"));
     this.btnMoveDown.Location = new System.Drawing.Point(0, 24);
     this.btnMoveDown.Margin   = new System.Windows.Forms.Padding(0, 0, 0, 3);
     this.btnMoveDown.Name     = "btnMoveDown";
     this.btnMoveDown.Size     = new System.Drawing.Size(28, 23);
     this.btnMoveDown.TabIndex = 2;
     //
     // btnMoveUp
     //
     this.btnMoveUp.Image    = new System.Drawing.Bitmap(this.GetType().Assembly.GetManifestResourceStream("GISShare.Controls.WinForm.Image.MoveUp.bmp"));
     this.btnMoveUp.Location = new System.Drawing.Point(0, 0);
     this.btnMoveUp.Margin   = new System.Windows.Forms.Padding(0, 0, 0, 1);
     this.btnMoveUp.Name     = "btnMoveUp";
     this.btnMoveUp.Size     = new System.Drawing.Size(28, 23);
     this.btnMoveUp.TabIndex = 0;
     //
     // vsPropertyGrid1
     //
     this.vsPropertyGrid1.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.vsPropertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
     this.vsPropertyGrid1.Location  = new System.Drawing.Point(346, 31);
     this.vsPropertyGrid1.Margin    = new System.Windows.Forms.Padding(3, 3, 13, 3);
     this.vsPropertyGrid1.Name      = "vsPropertyGrid1";
     this.tlpAll.SetRowSpan(this.vsPropertyGrid1, 2);
     this.vsPropertyGrid1.Size     = new System.Drawing.Size(283, 263);
     this.vsPropertyGrid1.TabIndex = 2;
     //
     // lblRight
     //
     this.lblRight.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.lblRight.Location = new System.Drawing.Point(346, 13);
     this.lblRight.Margin   = new System.Windows.Forms.Padding(3, 13, 13, 3);
     this.lblRight.Name     = "lblRight";
     this.lblRight.Size     = new System.Drawing.Size(283, 12);
     this.lblRight.TabIndex = 1;
     this.lblRight.Text     = "节点 属性(&P):";
     //
     // baseItemHost1
     //
     this.baseItemHost1.AllowDrop      = true;
     this.baseItemHost1.BaseItemObject = this.treeView1;
     this.baseItemHost1.Dock           = System.Windows.Forms.DockStyle.Fill;
     this.baseItemHost1.Location       = new System.Drawing.Point(13, 31);
     this.baseItemHost1.Name           = "treeView1";
     this.baseItemHost1.Size           = new System.Drawing.Size(283, 228);
     //
     // treeView1
     //
     this.treeView1.Location = new System.Drawing.Point(13, 31);
     this.treeView1.Margin   = new System.Windows.Forms.Padding(13, 3, 3, 3);
     this.treeView1.Name     = "treeView1";
     this.treeView1.Size     = new System.Drawing.Size(283, 228);
     //
     // lblLeft
     //
     this.lblLeft.Dock     = System.Windows.Forms.DockStyle.Bottom;
     this.lblLeft.Location = new System.Drawing.Point(13, 13);
     this.lblLeft.Margin   = new System.Windows.Forms.Padding(13, 13, 3, 3);
     this.lblLeft.Name     = "lblLeft";
     this.lblLeft.Size     = new System.Drawing.Size(283, 12);
     this.lblLeft.TabIndex = 4;
     this.lblLeft.Text     = "选择需要编辑的节点(&N):";
     //
     // overarchingTableLayoutPanel
     //
     this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.tlpAll.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     this.tlpAll.Controls.Add(this.tlpMoveDelete, 1, 1);
     this.tlpAll.Controls.Add(this.lblRight, 2, 0);
     this.tlpAll.Controls.Add(this.vsPropertyGrid1, 2, 1);
     this.tlpAll.Controls.Add(this.baseItemHost1, 0, 1);
     this.tlpAll.Controls.Add(this.lblLeft, 0, 0);
     this.tlpAll.Controls.Add(this.tlpAddNode, 0, 2);
     this.tlpAll.Controls.Add(this.tlpOkAndCancel, 2, 3);
     this.tlpAll.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tlpAll.Location = new System.Drawing.Point(0, 0);
     this.tlpAll.Name     = "tlpAll";
     this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpAll.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpAll.Size     = new System.Drawing.Size(642, 336);
     this.tlpAll.TabIndex = 0;
     //
     // navigationButtonsTableLayoutPanel
     //
     this.tlpMoveDelete.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     this.tlpMoveDelete.Controls.Add(this.btnMoveUp, 0, 0);
     this.tlpMoveDelete.Controls.Add(this.btnDelete, 0, 2);
     this.tlpMoveDelete.Controls.Add(this.btnMoveDown, 0, 1);
     this.tlpMoveDelete.Location = new System.Drawing.Point(302, 31);
     this.tlpMoveDelete.Margin   = new System.Windows.Forms.Padding(3, 3, 13, 3);
     this.tlpMoveDelete.Name     = "tlpMoveDelete";
     this.tlpMoveDelete.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpMoveDelete.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpMoveDelete.RowStyles.Add(new System.Windows.Forms.RowStyle());
     this.tlpMoveDelete.Size     = new System.Drawing.Size(28, 83);
     this.tlpMoveDelete.TabIndex = 0;
     //
     // TreeNodeCollectionForm
     //
     this.AcceptButton = this.btnOk;
     this.CancelButton = this.btnCancel;
     this.ClientSize   = new System.Drawing.Size(642, 336);
     this.Controls.Add(this.tlpAll);
     this.FormBorderStyle = FormBorderStyle.Sizable;
     this.HelpButton      = true;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "TreeNodeCollectionForm";
     this.ShowIcon        = false;
     this.ShowInTaskbar   = false;
     this.SizeGripStyle   = SizeGripStyle.Show;
     this.Text            = "TreeNode 编辑器";
     this.tlpOkAndCancel.ResumeLayout(false);
     this.tlpAddNode.ResumeLayout(false);
     this.tlpAll.ResumeLayout(false);
     this.tlpMoveDelete.ResumeLayout(false);
     this.ResumeLayout(false);
 }