TreeView 拖拽 增删改
- using Endv.Tools;
- using System;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- namespace Endv
- {
- public class Form1 : System.Windows.Forms.Form
- {
- private string DBConStr = "";
- private string AppPath = "";
- private ContextMenu tvSample1Menu = new ContextMenu();
- private ContextMenu tvSample2Menu = new ContextMenu();
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TreeView TreeView1;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.TreeView TreeView2;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Button button4;
- private System.Windows.Forms.Button button5;
- private System.Windows.Forms.Button button6;
- private DataGridView dataGridView1;
- private System.Windows.Forms.ImageList imageList1;
- #region Form Load
- private void Form1_Load(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);// 获取等待光标,通常是沙漏形状
- try
- {
- AppPath = UI.GetAppPath();
- DBConStr = SqlHelper.connectionString;
- //DBConStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + AppPath + "sample.mdb";
- //DBConStr = "Provider= Data Source=(local);Initial Catalog=oittest;User ID=sa;Password=123";
- tvSample1Menu.MenuItems.Add("Insert",
- new EventHandler(tvSample1RightClickInsert));
- tvSample1Menu.MenuItems.Add("Edit",
- new EventHandler(tvSample1RightClickEdit));
- tvSample1Menu.MenuItems.Add("Nudge Up",
- new EventHandler(tvSample1RightClickNudgeUp));
- tvSample1Menu.MenuItems.Add("Nudge Down",
- new EventHandler(tvSample1RightClickNudgeDown));
- tvSample1Menu.MenuItems.Add("Delete",
- new EventHandler(tvSample1RightClickDelete));
- tvSample2Menu.MenuItems.Add("Insert",
- new EventHandler(tvSample2RightClickInsert));
- tvSample2Menu.MenuItems.Add("Edit",
- new EventHandler(tvSample2RightClickEdit));
- tvSample2Menu.MenuItems.Add("Nudge Up",
- new EventHandler(tvSample2RightClickNudgeUp));
- tvSample2Menu.MenuItems.Add("Nudge Down",
- new EventHandler(tvSample2RightClickNudgeDown));
- tvSample2Menu.MenuItems.Add("Delete",
- new EventHandler(tvSample2RightClickDelete));
- LoadAllTrees();
- TreeView1.AllowDrop = true;
- TreeView2.AllowDrop = true;
- }
- catch (Exception err) { UI.Hourglass(false); UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region Load All Trees
- private void LoadAllTrees()
- {
- try
- {
- LoadTree(TreeView1, Datas.emp.GetHierarchy());
- LoadTree(TreeView2, Datas.emp.GetHierarchy( ));
- //Datas.emp.GetHierarchy(DBConStr, "A01")
- }
- catch (Exception) //
- { throw; }
- }
- #endregion
- #region Load Tree
- private void LoadTree(TreeView tv, DataSet ds)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.LoadFromDataSet(tv, ds, "Description");//描述
- if (tv.Nodes.Count > )
- {
- tv.Nodes[].Expand();
- }
- }
- catch (Exception) { throw; }
- finally
- {
- UI.Hourglass(false);
- }
- }
- #endregion
- #region TreeView1 右键删除 Right Click Delete
- private void tvSample1RightClickDelete(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.DeleteNode(TreeView1, true);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region TreeView2 右键删除 Right Click Delete
- private void tvSample2RightClickDelete(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.DeleteNode(TreeView2, true);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 Right Click Edit
- private void tvSample1RightClickEdit(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeNode node = TreeView1.SelectedNode;
- if (node == null) { return; }
- node.TreeView.LabelEdit = true;
- node.BeginEdit();
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Right Click Edit
- private void tvSample2RightClickEdit(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeNode node = TreeView2.SelectedNode;
- if (node == null) { return; }
- node.TreeView.LabelEdit = true;
- node.BeginEdit();
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 Right Click Nudge Up
- private void tvSample1RightClickNudgeUp(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.NudgeUp(TreeView1.SelectedNode);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 Right Click Nudge Down
- private void tvSample1RightClickNudgeDown(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.NudgeDown(TreeView1.SelectedNode);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Right Click Nudge Up
- private void tvSample2RightClickNudgeUp(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.NudgeUp(TreeView2.SelectedNode);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Right Click Nudge Down
- private void tvSample2RightClickNudgeDown(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeViewUtil.NudgeDown(TreeView2.SelectedNode);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 Right Click Insert
- private void tvSample1RightClickInsert(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeNode node = TreeView1.SelectedNode;
- if (node == null) { return; }
- InsertNewNode(node);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Right Click Insert
- private void tvSample2RightClickInsert(object sender, System.EventArgs e)
- {
- UI.Hourglass(true);
- try
- {
- TreeNode node = TreeView2.SelectedNode;
- if (node == null) { return; }
- InsertNewNode(node);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region Insert New Node
- private void InsertNewNode(TreeNode node)
- {
- DataRow row = null;
- DataRow ParentRow = null;
- DataTable dt = null;
- int newindex = ;
- try
- {
- ParentRow = (DataRow)node.Tag;
- if (ParentRow == null) { return; }
- newindex = int.Parse(ParentRow["SortOrder"].ToString()) + ;
- dt = ParentRow.Table;
- row = dt.NewRow();
- row["ObjectID"] = Guid.NewGuid().ToString();
- row["ObjectTypeID"] = ;
- row["ModelID"] = int.Parse(ParentRow["ModelID"].ToString());
- row["NodeID"] = Guid.NewGuid().ToString();
- row["ParentNodeID"] = ParentRow[dt.PrimaryKey[].ColumnName].ToString();
- row["Description"] = "New Node";
- row["ForeColor"] = "#000000";
- row["BackColor"] = "#FFFFFF";
- row["ImageIndex"] = ;
- row["SelectedImageIndex"] = ;
- row["Checked"] = true;
- row["ActiveID"] = ;
- row["NamedRange"] = "";
- row["NodeValue"] = "";
- row["LastUpdateTime"] = DateTime.Now;
- row["SortOrder"] = newindex;
- dt.Rows.Add(row);
- node.Nodes.Add(TreeViewUtil.GetTreeNodeFromDataRow(row, "Description"));
- }
- catch (Exception)
- {
- throw;
- }
- }
- #endregion
- #region Edit Node
- private void EditNode(TreeNode node, string newText)
- {
- DataRow row = null;
- try
- {
- if (node == null) { return; }
- row = (DataRow)node.Tag;
- if (row == null) { return; }
- row["Description"] = newText;
- }
- catch (Exception) { throw; }
- }
- #endregion
- #region 重载测试数据 Button Reload Test Data
- private void button1_Click(object sender, System.EventArgs e)
- {
- LoadAllTrees();
- }
- #endregion
- #region 导出树 Button Export Trees To Xml
- private void button2_Click(object sender, System.EventArgs e)
- {
- string filename = "";
- DataSet ds;
- DataRow row;
- DataSet compareds;
- try
- {
- UI.Hourglass(true);
- // Write out the contents of tvSample to disk
- filename = Path.Combine(AppPath, "treeview1.xml");
- if (File.Exists(filename)) { File.Delete(filename); }
- if (TreeView1.Nodes.Count == ) { return; }
- row = (DataRow)TreeView1.Nodes[].Tag;
- ds = row.Table.DataSet;
- compareds = ds.GetChanges();
- if (compareds != null)
- {
- compareds.WriteXml(filename, XmlWriteMode.DiffGram);
- }
- // Write out the contents of tvSample2 to disk
- filename = Path.Combine(AppPath, "treeview2.xml");
- if (File.Exists(filename)) { File.Delete(filename); }
- if (TreeView2.Nodes.Count == ) { return; }
- row = (DataRow)TreeView2.Nodes[].Tag;
- ds = row.Table.DataSet;
- compareds = ds.GetChanges();
- if (compareds != null)
- {
- compareds.WriteXml(filename, XmlWriteMode.DiffGram);
- }
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample Mouse Down
- private void tvSample_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- TreeViewUtil.SetSelectedNodeByPosition(TreeView1, e.X, e.Y);
- if (TreeView1.SelectedNode == null) { return; }
- if (e.Button == MouseButtons.Right) { return; }
- }
- #endregion
- #region tvSample MouseUp
- private void tvSample_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- switch (e.Button)
- {
- case MouseButtons.Right:
- tvSample1Menu.Show(TreeView1, new Point(e.X, e.Y));
- return;
- default:
- break;
- }
- }
- #endregion
- #region tvSample2 Mouse Down
- private void tvSample2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- TreeViewUtil.SetSelectedNodeByPosition(TreeView2, e.X, e.Y);
- if (TreeView2.SelectedNode == null) { return; }
- if (e.Button == MouseButtons.Right) { return; }
- }
- #endregion
- #region tvSample2 MouseUp
- private void tvSample2_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- switch (e.Button)
- {
- case MouseButtons.Right:
- tvSample2Menu.Show(TreeView2, new Point(e.X, e.Y));
- break;
- default:
- break;
- }
- }
- #endregion
- #region tvSample Drag And Drop Events
- private void tvSample_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
- {
- DoDragDrop(e.Item, DragDropEffects.Move);
- }
- private void tvSample_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
- {
- TreeViewUtil.DragEnter((TreeView)sender, e);
- }
- private void tvSample_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
- {
- TreeViewUtil.DragOver((TreeView)sender, e);
- }
- private void tvSample_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
- {
- DataRow row;
- bool dropOnNewControl = false;
- try
- {
- UI.Hourglass(true);
- TreeViewUtil.DragDrop((TreeView)sender, e, ref dropOnNewControl);
- if (dropOnNewControl)
- {
- row = (DataRow)TreeView2.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- row = (DataRow)TreeView1.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- }
- // this.LoadAllTrees();
- UI.Hourglass(false);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Drag And Drop Events
- private void tvSample2_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
- {
- DoDragDrop(e.Item, DragDropEffects.Move);
- }
- private void tvSample2_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
- {
- TreeViewUtil.DragEnter((TreeView)sender, e);
- }
- private void tvSample2_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
- {
- TreeViewUtil.DragOver((TreeView)sender, e);
- }
- private void tvSample2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
- {
- DataRow row;
- bool dropOnNewControl = false;
- try
- {
- UI.Hourglass(true);
- TreeViewUtil.DragDrop((TreeView)sender, e, ref dropOnNewControl);
- if (dropOnNewControl)
- {
- row = (DataRow)TreeView1.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- row = (DataRow)TreeView2.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- }
- UI.Hourglass(false);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 After Label Edit
- private void tvSample_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
- {
- try
- {
- if (e.Label.Trim().Length < ) { e.CancelEdit = true; }
- EditNode(TreeView1.SelectedNode, e.Label);
- TreeView1.SelectedNode.EndEdit(false);
- TreeView1.LabelEdit = false;
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- }
- #endregion
- #region tvSample2 After Label Edit
- private void tvSample2_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
- {
- try
- {
- if (e.Label.Trim().Length < ) { e.CancelEdit = true; }
- EditNode(TreeView2.SelectedNode, e.Label);
- TreeView2.SelectedNode.EndEdit(false);
- TreeView2.LabelEdit = false;
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- }
- #endregion
- #region tvSample1 Accept Changes
- private void button3_Click(object sender, System.EventArgs e)
- {
- DataRow row = null;
- UI.Hourglass(true);
- try
- {
- if (TreeView1.Nodes.Count == ) { return; }
- row = (DataRow)TreeView1.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample1 拒绝更改 Reject Changes
- private void button4_Click(object sender, System.EventArgs e)
- {
- DataRow row = null;
- UI.Hourglass(true);
- try
- {
- if (TreeView1.Nodes.Count < ) { return; }
- row = (DataRow)TreeView1.Nodes[].Tag;
- row.Table.DataSet.RejectChanges();
- LoadTree(TreeView1, row.Table.DataSet);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 接受变化 Accept Changes
- private void button6_Click(object sender, System.EventArgs e)
- {
- DataRow row = null;
- UI.Hourglass(true);
- try
- {
- if (TreeView2.Nodes.Count == ) { return; }
- row = (DataRow)TreeView2.Nodes[].Tag;
- Datas.emp.CommitHierarchy(DBConStr, row.Table.DataSet);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region tvSample2 Reject Changes
- private void button5_Click(object sender, System.EventArgs e)
- {
- DataRow row = null;
- UI.Hourglass(true);
- try
- {
- if (TreeView2.Nodes.Count < ) { return; }
- row = (DataRow)TreeView2.Nodes[].Tag;
- row.Table.DataSet.RejectChanges();
- LoadTree(TreeView2, row.Table.DataSet);
- }
- catch (Exception err) { UI.ShowError(err.Message); }
- finally { UI.Hourglass(false); }
- }
- #endregion
- #region Form Closed
- private void Form1_Closed(object sender, System.EventArgs e)
- {
- }
- #endregion
- #region Exit
- private void cmdExit_Click(object sender, System.EventArgs e)
- {
- this.Close();
- Application.Exit();
- }
- #endregion
- #region Constructor
- [STAThread]
- static void Main()
- {
- Application.Run(new Form1());
- }
- public Form1()
- {
- InitializeComponent();
- }
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose(disposing);
- }
- #endregion
- #region Windows Form Designer generated code
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.label1 = new System.Windows.Forms.Label();
- this.TreeView1 = new System.Windows.Forms.TreeView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.TreeView2 = new System.Windows.Forms.TreeView();
- this.label2 = new System.Windows.Forms.Label();
- this.button3 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(, );
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(, );
- this.label1.TabIndex = ;
- this.label1.Text = "Tree 1";
- //
- // TreeView1
- //
- this.TreeView1.AllowDrop = true;
- this.TreeView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TreeView1.HideSelection = false;
- this.TreeView1.ImageIndex = ;
- this.TreeView1.ImageList = this.imageList1;
- this.TreeView1.Location = new System.Drawing.Point(, );
- this.TreeView1.Name = "TreeView1";
- this.TreeView1.SelectedImageIndex = ;
- this.TreeView1.Size = new System.Drawing.Size(, );
- this.TreeView1.TabIndex = ;
- this.TreeView1.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.tvSample_AfterLabelEdit);
- this.TreeView1.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.tvSample_ItemDrag);
- this.TreeView1.DragDrop += new System.Windows.Forms.DragEventHandler(this.tvSample_DragDrop);
- this.TreeView1.DragEnter += new System.Windows.Forms.DragEventHandler(this.tvSample_DragEnter);
- this.TreeView1.DragOver += new System.Windows.Forms.DragEventHandler(this.tvSample_DragOver);
- this.TreeView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tvSample_MouseDown);
- this.TreeView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tvSample_MouseUp);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(, );
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(, );
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(, );
- this.button1.TabIndex = ;
- this.button1.Text = "Reload Test Data";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(, );
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(, );
- this.button2.TabIndex = ;
- this.button2.Text = "Save Xml To Root Folder";
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // TreeView2
- //
- this.TreeView2.AllowDrop = true;
- this.TreeView2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.TreeView2.ImageIndex = ;
- this.TreeView2.ImageList = this.imageList1;
- this.TreeView2.Location = new System.Drawing.Point(, );
- this.TreeView2.Name = "TreeView2";
- this.TreeView2.SelectedImageIndex = ;
- this.TreeView2.Size = new System.Drawing.Size(, );
- this.TreeView2.TabIndex = ;
- this.TreeView2.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.tvSample2_AfterLabelEdit);
- this.TreeView2.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.tvSample2_ItemDrag);
- this.TreeView2.DragDrop += new System.Windows.Forms.DragEventHandler(this.tvSample2_DragDrop);
- this.TreeView2.DragEnter += new System.Windows.Forms.DragEventHandler(this.tvSample2_DragEnter);
- this.TreeView2.DragOver += new System.Windows.Forms.DragEventHandler(this.tvSample2_DragOver);
- this.TreeView2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tvSample2_MouseDown);
- this.TreeView2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tvSample2_MouseUp);
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(, );
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(, );
- this.label2.TabIndex = ;
- this.label2.Text = "Tree 2";
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(, );
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(, );
- this.button3.TabIndex = ;
- this.button3.Text = "Accept Changes";
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(, );
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(, );
- this.button4.TabIndex = ;
- this.button4.Text = "Reject Changes";
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(, );
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(, );
- this.button5.TabIndex = ;
- this.button5.Text = "Reject Changes";
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(, );
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(, );
- this.button6.TabIndex = ;
- this.button6.Text = "Accept Changes";
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // dataGridView1
- //
- this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView1.Location = new System.Drawing.Point(, );
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.RowTemplate.Height = ;
- this.dataGridView1.Size = new System.Drawing.Size(, );
- this.dataGridView1.TabIndex = ;
- //
- // Form1
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(, );
- this.ClientSize = new System.Drawing.Size(, );
- this.Controls.Add(this.dataGridView1);
- this.Controls.Add(this.button5);
- this.Controls.Add(this.button6);
- this.Controls.Add(this.button4);
- this.Controls.Add(this.button3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.TreeView2);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.TreeView1);
- this.Controls.Add(this.label1);
- this.MaximizeBox = false;
- this.Name = "Form1";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "Tree Sample";
- this.Closed += new System.EventHandler(this.Form1_Closed);
- this.Load += new System.EventHandler(this.Form1_Load);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- }
- }
TreeView 拖拽 增删改的更多相关文章
- TREEVIEW拖拽对应修改目录
附件:http://files.cnblogs.com/xe2011/TreeView_Drag_Directory%E6%93%8D%E4%BD%9C.rar TREEVIEW拖拽对应修改目 ...
- C# TreeView 拖拽节点到另一个容器Panel中简单实现
C# TreeView 拖拽节点到另一个容器Panel中简单实现 用了这么久C#拖拽功能一直没有用到也就没用过,今天因为项目需要,领导特地给我简单讲解了下拖拽功能,真是的大师讲解一点通啊.特地写一篇博 ...
- winform 两个TreeView间拖拽节点
/// <summary> /// 正在拖拽的节点 /// </summary> private TreeNode DragNode = null; /// <summa ...
- [译]聊聊C#中的泛型的使用(新手勿入) Seaching TreeVIew WPF 可编辑树Ztree的使用(包括对后台数据库的增删改查) 字段和属性的区别 C# 遍历Dictionary并修改其中的Value 学习笔记——异步 程序员常说的「哈希表」是个什么鬼?
[译]聊聊C#中的泛型的使用(新手勿入) 写在前面 今天忙里偷闲在浏览外文的时候看到一篇讲C#中泛型的使用的文章,因此加上本人的理解以及四级没过的英语水平斗胆给大伙进行了翻译,当然在翻译的过程中发 ...
- Delphi Treeview 用法(概念、属性、添加编辑插入节点、定位节点、拖拽等)
今天再细研究了一下Treeview的用法,网上虽然总结了很多,但是还是有很多节点没有讲到了,也给使用中遇到很多问题.特地总结一下: 1.概念 Treeview用于显示按照树形结构进行组织的数据.Tre ...
- TREEVIEW节点拖拽
http://files.cnblogs.com/xe2011/TreeView_Drag_and_Drop.rar 假设把A节点往B节点上拖拽 那么 A 为Node1,B为Node2 ...
- react之每日一更(实现canvas拖拽,增、删、改拖拽模块大小功能)
效果图: import React, { Component } from 'react'; import scaleImage from './images/scale.png'; import c ...
- SQL你必须知道的-增删改查与约束
SQL你必须知道的-增删改查与约束 -- 插入数据 --Insert 语句可以省略表名后的列名,但是不推荐 insert into Class values ('' 高一一班 '', ...
- mysql实现简单的增删改查,放入xmapp自带数据库中
1.mysql概念:SQL-Structured Query Language,是一种特殊的语言,专用于操作关系型数据库服务器中的数据,所有的SQL语句分为四类: (1)DDL(2)DQL(3)DML ...
随机推荐
- [ Python - 6 ] 正则表达式实现计算器功能
要求:禁止使用eval函数.参考网上代码如下: #!_*_coding:utf-8_*_ """用户输入计算表达式,显示计算结果""" im ...
- 【SQL】数据库更新
1.插入 INSERT INTO R(A1,A2,...An) VALUES(v1, v2, ...,vn) 如果插入了所有属性,并且按照定义的顺序给出,可以省略(A1,A2,...An) 可以只插入 ...
- QPS、TPS、PV等网站业务关键字释义
QPS:Query Per Second TPS:Transaction Per Second PV:Page View RT:Response Time UV:Unique Visitor DAU: ...
- [设计模式-行为型]访问者模式(Vistor)
一句话 表示一个作用于某对象结构中的各元素的操作.它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作. 概括
- ros pcl sensor::pointcloud2 转换成pcl::pointcloud
#include <pcl_conversions/pcl_conversions.h> #include <pcl/point_types.h> #include <p ...
- 【hdoj_1009】FatMouse's Trade
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1009< 本题用到贪心策略和结构体排序. 问题简化:现有资本M,N个房间,第i个房间对应着价格为F[i ...
- 【原创】Maven cobertura整合多个子项目下的单测覆盖率报告
今天在调试一个UT job的时候发现找不到cobertural报告文件,后来发现在Maven的自项目里找到了对应的代码覆盖率报告,但都是是分散在每个子项目下面的,看起来很不方便.就在想是不是可以把这些 ...
- zabbix监控web应用
1)web应用监控介绍 使用zabbix自带的web场景可以监控url的状态码,响应时间,url的下载速度,非常的棒 思路:定义模板-->创建应用集--->定义web场景--->定义 ...
- kotlin 写的一个简单 sql 查询解析器
package com.dx.efuwu.core import org.apache.commons.lang.StringUtils import java.sql.PreparedStateme ...
- 洛谷 P2678 跳石头【经典二分答案/贪心】
题目描述 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石.组委会已经选择好了两块岩石作为比赛起点和终点.在起点和终点之间,有 NN 块岩石(不含起点和终点的岩石).在比赛过程中,选手们将从 ...