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

📄 frmcn.cs

📁 自定义协议
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Text;

namespace CodeManager
{
	/// <summary>
	/// Frmcn 的摘要说明。
	/// </summary>
	public class Frmcn : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.TextBox tbNewName;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button btnCn;
		private System.Windows.Forms.Button btnCancel;
		private MainForm theApp;
		private int nOType;
		private String szOldName;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Frmcn(MainForm mf, int nType, String szName)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			theApp = mf;
			nOType = nType;
			szOldName = szName;

		}

		/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
			this.tbNewName = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.btnCn = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.btnCancel);
			this.groupBox1.Controls.Add(this.btnCn);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.tbNewName);
			this.groupBox1.Location = new System.Drawing.Point(16, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(264, 112);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "新目录或文件名";
			// 
			// tbNewName
			// 
			this.tbNewName.Location = new System.Drawing.Point(104, 32);
			this.tbNewName.Name = "tbNewName";
			this.tbNewName.Size = new System.Drawing.Size(144, 21);
			this.tbNewName.TabIndex = 0;
			this.tbNewName.Text = "";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "请输入名称:";
			// 
			// btnCn
			// 
			this.btnCn.Location = new System.Drawing.Point(16, 72);
			this.btnCn.Name = "btnCn";
			this.btnCn.Size = new System.Drawing.Size(104, 24);
			this.btnCn.TabIndex = 2;
			this.btnCn.Text = "确  定";
			this.btnCn.Click += new System.EventHandler(this.btnCn_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(144, 72);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(104, 24);
			this.btnCancel.TabIndex = 3;
			this.btnCancel.Text = "关  闭";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// Frmcn
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(296, 133);
			this.Controls.Add(this.groupBox1);
			this.Name = "Frmcn";
			this.Text = "新名称";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

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

		private void btnCn_Click(object sender, System.EventArgs e)
		{
			if ( "" == tbNewName.Text || null == tbNewName.Text)
			{
				MessageBox.Show("文件或目录名不能为空!");
				return;
			}
			if (1 == nOType)
			{
				theApp.ParseCMSG_SendPacket(defcmd.RND,Encoding.GetEncoding(936).GetBytes(String.Format("{0}\n{1}\n", szOldName, tbNewName.Text)));
			}
			else if (2 == nOType)
			{
				theApp.ParseCMSG_SendPacket(defcmd.RNF,Encoding.GetEncoding(936).GetBytes(String.Format("{0}\n{1}\n", szOldName, tbNewName.Text)));
			}
		}
	}
}

⌨️ 快捷键说明

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