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

📄 add.cs

📁 真的很不错哦 用了c#开发 面向对象过程
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace UI
{
	/// <summary>
	/// Add 的摘要说明。
	/// </summary>
	public class Add : System.Windows.Forms.Form
	{
		
		private Point mouseOffset;
		bool isMouseDown;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtrid;
		private System.Windows.Forms.Button btnsure;
		private System.Windows.Forms.Button btncancel;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Add()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			isMouseDown=false;

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Add));
			this.label1 = new System.Windows.Forms.Label();
			this.txtrid = new System.Windows.Forms.TextBox();
			this.btnsure = new System.Windows.Forms.Button();
			this.btncancel = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.AccessibleDescription = resources.GetString("label1.AccessibleDescription");
			this.label1.AccessibleName = resources.GetString("label1.AccessibleName");
			this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));
			this.label1.AutoSize = ((bool)(resources.GetObject("label1.AutoSize")));
			this.label1.BackColor = System.Drawing.Color.MistyRose;
			this.label1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label1.Dock")));
			this.label1.Enabled = ((bool)(resources.GetObject("label1.Enabled")));
			this.label1.Font = ((System.Drawing.Font)(resources.GetObject("label1.Font")));
			this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));
			this.label1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.ImageAlign")));
			this.label1.ImageIndex = ((int)(resources.GetObject("label1.ImageIndex")));
			this.label1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label1.ImeMode")));
			this.label1.Location = ((System.Drawing.Point)(resources.GetObject("label1.Location")));
			this.label1.Name = "label1";
			this.label1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label1.RightToLeft")));
			this.label1.Size = ((System.Drawing.Size)(resources.GetObject("label1.Size")));
			this.label1.TabIndex = ((int)(resources.GetObject("label1.TabIndex")));
			this.label1.Text = resources.GetString("label1.Text");
			this.label1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.TextAlign")));
			this.label1.Visible = ((bool)(resources.GetObject("label1.Visible")));
			// 
			// txtrid
			// 
			this.txtrid.AccessibleDescription = resources.GetString("txtrid.AccessibleDescription");
			this.txtrid.AccessibleName = resources.GetString("txtrid.AccessibleName");
			this.txtrid.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtrid.Anchor")));
			this.txtrid.AutoSize = ((bool)(resources.GetObject("txtrid.AutoSize")));
			this.txtrid.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtrid.BackgroundImage")));
			this.txtrid.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtrid.Dock")));
			this.txtrid.Enabled = ((bool)(resources.GetObject("txtrid.Enabled")));
			this.txtrid.Font = ((System.Drawing.Font)(resources.GetObject("txtrid.Font")));
			this.txtrid.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtrid.ImeMode")));
			this.txtrid.Location = ((System.Drawing.Point)(resources.GetObject("txtrid.Location")));
			this.txtrid.MaxLength = ((int)(resources.GetObject("txtrid.MaxLength")));
			this.txtrid.Multiline = ((bool)(resources.GetObject("txtrid.Multiline")));
			this.txtrid.Name = "txtrid";
			this.txtrid.PasswordChar = ((char)(resources.GetObject("txtrid.PasswordChar")));
			this.txtrid.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtrid.RightToLeft")));
			this.txtrid.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtrid.ScrollBars")));
			this.txtrid.Size = ((System.Drawing.Size)(resources.GetObject("txtrid.Size")));
			this.txtrid.TabIndex = ((int)(resources.GetObject("txtrid.TabIndex")));
			this.txtrid.Text = resources.GetString("txtrid.Text");
			this.txtrid.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtrid.TextAlign")));
			this.txtrid.Visible = ((bool)(resources.GetObject("txtrid.Visible")));
			this.txtrid.WordWrap = ((bool)(resources.GetObject("txtrid.WordWrap")));
			// 
			// btnsure
			// 
			this.btnsure.AccessibleDescription = resources.GetString("btnsure.AccessibleDescription");
			this.btnsure.AccessibleName = resources.GetString("btnsure.AccessibleName");
			this.btnsure.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnsure.Anchor")));
			this.btnsure.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnsure.BackgroundImage")));
			this.btnsure.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnsure.Dock")));
			this.btnsure.Enabled = ((bool)(resources.GetObject("btnsure.Enabled")));
			this.btnsure.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnsure.FlatStyle")));
			this.btnsure.Font = ((System.Drawing.Font)(resources.GetObject("btnsure.Font")));
			this.btnsure.Image = ((System.Drawing.Image)(resources.GetObject("btnsure.Image")));
			this.btnsure.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnsure.ImageAlign")));
			this.btnsure.ImageIndex = ((int)(resources.GetObject("btnsure.ImageIndex")));
			this.btnsure.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnsure.ImeMode")));
			this.btnsure.Location = ((System.Drawing.Point)(resources.GetObject("btnsure.Location")));
			this.btnsure.Name = "btnsure";
			this.btnsure.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnsure.RightToLeft")));
			this.btnsure.Size = ((System.Drawing.Size)(resources.GetObject("btnsure.Size")));
			this.btnsure.TabIndex = ((int)(resources.GetObject("btnsure.TabIndex")));
			this.btnsure.Text = resources.GetString("btnsure.Text");
			this.btnsure.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnsure.TextAlign")));
			this.btnsure.Visible = ((bool)(resources.GetObject("btnsure.Visible")));
			this.btnsure.Click += new System.EventHandler(this.btnsure_Click);
			// 
			// btncancel
			// 
			this.btncancel.AccessibleDescription = resources.GetString("btncancel.AccessibleDescription");
			this.btncancel.AccessibleName = resources.GetString("btncancel.AccessibleName");
			this.btncancel.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btncancel.Anchor")));
			this.btncancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btncancel.BackgroundImage")));
			this.btncancel.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btncancel.Dock")));
			this.btncancel.Enabled = ((bool)(resources.GetObject("btncancel.Enabled")));
			this.btncancel.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btncancel.FlatStyle")));
			this.btncancel.Font = ((System.Drawing.Font)(resources.GetObject("btncancel.Font")));
			this.btncancel.ForeColor = System.Drawing.SystemColors.ControlText;
			this.btncancel.Image = ((System.Drawing.Image)(resources.GetObject("btncancel.Image")));
			this.btncancel.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btncancel.ImageAlign")));
			this.btncancel.ImageIndex = ((int)(resources.GetObject("btncancel.ImageIndex")));
			this.btncancel.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btncancel.ImeMode")));
			this.btncancel.Location = ((System.Drawing.Point)(resources.GetObject("btncancel.Location")));
			this.btncancel.Name = "btncancel";
			this.btncancel.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btncancel.RightToLeft")));
			this.btncancel.Size = ((System.Drawing.Size)(resources.GetObject("btncancel.Size")));
			this.btncancel.TabIndex = ((int)(resources.GetObject("btncancel.TabIndex")));
			this.btncancel.Text = resources.GetString("btncancel.Text");
			this.btncancel.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btncancel.TextAlign")));
			this.btncancel.Visible = ((bool)(resources.GetObject("btncancel.Visible")));
			this.btncancel.Click += new System.EventHandler(this.btncancel_Click);
			// 
			// Add
			// 
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackColor = System.Drawing.Color.MistyRose;
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.btncancel);
			this.Controls.Add(this.btnsure);
			this.Controls.Add(this.txtrid);
			this.Controls.Add(this.label1);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
			this.Name = "Add";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
			this.Text = resources.GetString("$this.Text");
			this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Add_MouseDown);
			this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Add_MouseUp);
			this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Add_MouseMove);
			this.ResumeLayout(false);

		}
		#endregion

		private void Add_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Left) 
			{
				mouseOffset = new Point(-e.X, -e.Y);
				isMouseDown = true;
			}
		}

		private void Add_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if (isMouseDown) 
			{
				Point mousePos = Control.MousePosition;
				mousePos.Offset(mouseOffset.X, mouseOffset.Y);
				Location = mousePos;
			}
		
		}

		private void Add_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			isMouseDown=false;
		}

		private void btncancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnsure_Click(object sender, System.EventArgs e)
		{
			string rid=this.txtrid.Text;
			AddConsume ac=new AddConsume(rid);
			ac.Show();
			this.Close();
		}
	}
}

⌨️ 快捷键说明

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