⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editpc.cs

📁 机械制造业信息管理系统(含源码) 是为一个粮仪厂开发的
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using System.Data;
using System.Data.OleDb;

namespace Eboer.MIS.MF.WinForm
{
	/// <summary>
	/// EditPC 的摘要说明。
	/// </summary>
	public class EditPC : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TreeView treeView;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.ImageList imageList;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox memo;
		private System.Windows.Forms.TextBox thisName;
		private System.Windows.Forms.TextBox thisSign;
		private System.Windows.Forms.TextBox price;
		private System.Windows.Forms.TextBox unitName;
		private System.Windows.Forms.ContextMenu contextMenu;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem7;

		/// <summary>
		/// 树形结构数据源
		/// </summary>
		private DataSet ds = null;

		/// <summary>
		/// 当前选中的节点标识
		/// </summary>
		private string   currSign = null;
		private string   autoID   = null;
		private TreeNode currNode = null;

		/// <summary>
		/// 是否修改
		/// </summary>
		private bool   edit     = false;
		private System.Windows.Forms.GroupBox editArea;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox gg;

		/// <summary>
		/// 新建数据所在层,本层或下层
		/// </summary>
		private int    addToLay = 0;

		public EditPC()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			this.LoadTree();

			//为树增加一个鼠标点击的事件
			this.treeView.MouseDown += new MouseEventHandler(ClickInTreeView);

			//
			this.editArea.Text = "新建产品目录档案";

			//
			this.button1.Enabled = false;
			this.button2.Enabled = false;

			this.SetThisSign();
		}

		/// <summary>
		/// 载入树结构
		/// </summary>
		private void LoadTree(){

			try{
				string sql = "select * from ProductCatalog order by treeID asc";

				OleDbDataAdapter ad = new OleDbDataAdapter(sql,Public.conn);

				this.ds = new DataSet();
				ad.Fill(ds,"tree");

				this.treeView.Nodes.Clear();
				this.CreateTree(0,null);
				this.treeView.ExpandAll();

			}catch(Exception ex){
				MessageBox.Show(ex.Message.ToString());
				return;
			}
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(EditPC));
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.treeView = new System.Windows.Forms.TreeView();
			this.contextMenu = new System.Windows.Forms.ContextMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.imageList = new System.Windows.Forms.ImageList(this.components);
			this.editArea = new System.Windows.Forms.GroupBox();
			this.gg = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.unitName = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.price = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.memo = new System.Windows.Forms.TextBox();
			this.thisName = new System.Windows.Forms.TextBox();
			this.thisSign = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.editArea.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.treeView);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(496, 448);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "目录信息";
			// 
			// treeView
			// 
			this.treeView.ContextMenu = this.contextMenu;
			this.treeView.ImageList = this.imageList;
			this.treeView.Location = new System.Drawing.Point(8, 16);
			this.treeView.Name = "treeView";
			this.treeView.Size = new System.Drawing.Size(480, 424);
			this.treeView.TabIndex = 0;
			// 
			// contextMenu
			// 
			this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						this.menuItem1,
																						this.menuItem2,
																						this.menuItem3,
																						this.menuItem5,
																						this.menuItem6,
																						this.menuItem7});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "新建本级档案";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "新建下级档案";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "-";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 3;
			this.menuItem5.Text = "删除当前档案";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 4;
			this.menuItem6.Text = "-";
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 5;
			this.menuItem7.Text = "刷新目录结构";
			this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
			// 
			// imageList
			// 
			this.imageList.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
			this.imageList.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// editArea
			// 
			this.editArea.Controls.Add(this.gg);
			this.editArea.Controls.Add(this.label1);
			this.editArea.Controls.Add(this.unitName);
			this.editArea.Controls.Add(this.label6);
			this.editArea.Controls.Add(this.price);
			this.editArea.Controls.Add(this.label5);
			this.editArea.Controls.Add(this.memo);
			this.editArea.Controls.Add(this.thisName);
			this.editArea.Controls.Add(this.thisSign);
			this.editArea.Controls.Add(this.label4);
			this.editArea.Controls.Add(this.label3);
			this.editArea.Controls.Add(this.label2);
			this.editArea.Location = new System.Drawing.Point(512, 8);
			this.editArea.Name = "editArea";
			this.editArea.Size = new System.Drawing.Size(240, 232);
			this.editArea.TabIndex = 1;
			this.editArea.TabStop = false;
			this.editArea.Text = "设置";
			this.editArea.Enter += new System.EventHandler(this.editArea_Enter);
			// 
			// gg
			// 
			this.gg.Location = new System.Drawing.Point(96, 48);
			this.gg.Name = "gg";
			this.gg.Size = new System.Drawing.Size(136, 21);
			this.gg.TabIndex = 2;
			this.gg.Text = "";
			this.gg.TextChanged += new System.EventHandler(this.gg_TextChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 56);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 14;
			this.label1.Text = "规格";
			// 
			// unitName
			// 
			this.unitName.Location = new System.Drawing.Point(64, 96);
			this.unitName.Name = "unitName";
			this.unitName.Size = new System.Drawing.Size(168, 21);
			this.unitName.TabIndex = 4;
			this.unitName.Text = "";
			this.unitName.TextChanged += new System.EventHandler(this.unitName_TextChanged);
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(8, 104);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(88, 16);
			this.label6.TabIndex = 12;
			this.label6.Text = "计量单位";
			// 
			// price
			// 
			this.price.Location = new System.Drawing.Point(64, 120);
			this.price.Name = "price";
			this.price.Size = new System.Drawing.Size(168, 21);
			this.price.TabIndex = 5;
			this.price.Text = "0.00";
			this.price.TextChanged += new System.EventHandler(this.price_TextChanged);
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(8, 128);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(80, 16);
			this.label5.TabIndex = 8;
			this.label5.Text = "单价(¥)";
			// 
			// memo
			// 
			this.memo.Location = new System.Drawing.Point(64, 144);
			this.memo.Multiline = true;
			this.memo.Name = "memo";
			this.memo.Size = new System.Drawing.Size(168, 72);
			this.memo.TabIndex = 6;
			this.memo.Text = "";
			this.memo.TextChanged += new System.EventHandler(this.memo_TextChanged);
			// 
			// thisName
			// 
			this.thisName.Location = new System.Drawing.Point(96, 72);
			this.thisName.Name = "thisName";
			this.thisName.Size = new System.Drawing.Size(136, 21);
			this.thisName.TabIndex = 3;
			this.thisName.Text = "";
			this.thisName.TextChanged += new System.EventHandler(this.thisName_TextChanged);
			// 
			// thisSign
			// 
			this.thisSign.Location = new System.Drawing.Point(96, 24);
			this.thisSign.Name = "thisSign";
			this.thisSign.Size = new System.Drawing.Size(136, 21);
			this.thisSign.TabIndex = 1;
			this.thisSign.Text = "";
			this.thisSign.TextChanged += new System.EventHandler(this.thisSign_TextChanged);
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(8, 144);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(64, 16);
			this.label4.TabIndex = 3;
			this.label4.Text = "目录备注";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(8, 80);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(88, 16);
			this.label3.TabIndex = 2;
			this.label3.Text = "目录名称/品名";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(88, 16);
			this.label2.TabIndex = 1;
			this.label2.Text = "目录/产品编号";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(624, 248);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(72, 23);
			this.button1.TabIndex = 7;
			this.button1.Text = "保存变动";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(696, 248);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(56, 23);
			this.button2.TabIndex = 8;
			this.button2.Text = "取 消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// EditPC
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(760, 461);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.editArea);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.button1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "EditPC";
			this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -