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

📄 frmoptionalargu.cs

📁 个人信息的源代码
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Utilities;

namespace PersonalInfo
{
	/// <summary>
	/// frmOptionalArgu 的摘要说明。
	/// </summary>
	public class frmOptionalArgu : System.Windows.Forms.Form
	{
		#region Windows 窗体设计器生成的代码

		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.TabPage tpgGeneral;
		private System.Windows.Forms.TabPage tpgDebug;
		private System.Windows.Forms.CheckBox ckbBackup;
		private System.Windows.Forms.CheckBox ckbAutoExpand;
		private System.Windows.Forms.CheckBox ckbDebug;
		private System.Windows.Forms.Button btnClearLogFile;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label1;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

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

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

		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tpgGeneral = new System.Windows.Forms.TabPage();
			this.ckbBackup = new System.Windows.Forms.CheckBox();
			this.ckbAutoExpand = new System.Windows.Forms.CheckBox();
			this.tpgDebug = new System.Windows.Forms.TabPage();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.btnClearLogFile = new System.Windows.Forms.Button();
			this.ckbDebug = new System.Windows.Forms.CheckBox();
			this.btnOK = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.tabControl1.SuspendLayout();
			this.tpgGeneral.SuspendLayout();
			this.tpgDebug.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tpgGeneral);
			this.tabControl1.Controls.Add(this.tpgDebug);
			this.tabControl1.Location = new System.Drawing.Point(34, 19);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(332, 173);
			this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight;
			this.tabControl1.TabIndex = 0;
			// 
			// tpgGeneral
			// 
			this.tpgGeneral.BackColor = System.Drawing.Color.Transparent;
			this.tpgGeneral.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.tpgGeneral.Controls.Add(this.ckbBackup);
			this.tpgGeneral.Controls.Add(this.ckbAutoExpand);
			this.tpgGeneral.Location = new System.Drawing.Point(4, 21);
			this.tpgGeneral.Name = "tpgGeneral";
			this.tpgGeneral.Size = new System.Drawing.Size(324, 148);
			this.tpgGeneral.TabIndex = 0;
			this.tpgGeneral.Text = "数据备份";
			// 
			// ckbBackup
			// 
			this.ckbBackup.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.ckbBackup.Location = new System.Drawing.Point(56, 32);
			this.ckbBackup.Name = "ckbBackup";
			this.ckbBackup.Size = new System.Drawing.Size(144, 24);
			this.ckbBackup.TabIndex = 0;
			this.ckbBackup.Text = "退出时自动备份数据";
			// 
			// ckbAutoExpand
			// 
			this.ckbAutoExpand.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.ckbAutoExpand.Location = new System.Drawing.Point(56, 80);
			this.ckbAutoExpand.Name = "ckbAutoExpand";
			this.ckbAutoExpand.Size = new System.Drawing.Size(144, 24);
			this.ckbAutoExpand.TabIndex = 0;
			this.ckbAutoExpand.Text = "单击时自动展开子树";
			// 
			// tpgDebug
			// 
			this.tpgDebug.BackColor = System.Drawing.Color.Transparent;
			this.tpgDebug.Controls.Add(this.label1);
			this.tpgDebug.Controls.Add(this.textBox1);
			this.tpgDebug.Controls.Add(this.btnClearLogFile);
			this.tpgDebug.Controls.Add(this.ckbDebug);
			this.tpgDebug.Location = new System.Drawing.Point(4, 21);
			this.tpgDebug.Name = "tpgDebug";
			this.tpgDebug.Size = new System.Drawing.Size(324, 148);
			this.tpgDebug.TabIndex = 1;
			this.tpgDebug.Text = "系统调试";
			// 
			// textBox1
			// 
			this.textBox1.BackColor = System.Drawing.SystemColors.Info;
			this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textBox1.Location = new System.Drawing.Point(18, 59);
			this.textBox1.Multiline = true;
			this.textBox1.Name = "textBox1";
			this.textBox1.ReadOnly = true;
			this.textBox1.Size = new System.Drawing.Size(288, 68);
			this.textBox1.TabIndex = 2;
			this.textBox1.Text = "为了方便调试程序错误,\r\n系统内置自动跟踪记录用户操作的功能。\r\n当此开发关被打开时,\r\n所有操作信息被放入MyTrace.txt文件中。\r\n默认情况下为提高性能" +
				",此开关是关闭的。";
			// 
			// btnClearLogFile
			// 
			this.btnClearLogFile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnClearLogFile.Location = new System.Drawing.Point(192, 13);
			this.btnClearLogFile.Name = "btnClearLogFile";
			this.btnClearLogFile.Size = new System.Drawing.Size(112, 32);
			this.btnClearLogFile.TabIndex = 1;
			this.btnClearLogFile.Text = "清空日志文件";
			this.btnClearLogFile.Click += new System.EventHandler(this.btnClearLogFile_Click);
			// 
			// ckbDebug
			// 
			this.ckbDebug.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.ckbDebug.Location = new System.Drawing.Point(14, 9);
			this.ckbDebug.Name = "ckbDebug";
			this.ckbDebug.TabIndex = 0;
			this.ckbDebug.Text = "启用日志跟踪";
			// 
			// btnOK
			// 
			this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnOK.Location = new System.Drawing.Point(179, 216);
			this.btnOK.Name = "btnOK";
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnCancel.Location = new System.Drawing.Point(283, 216);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(75, 24);
			this.btnCancel.TabIndex = 1;
			this.btnCancel.Text = "取消";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(16, 38);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(42, 17);
			this.label1.TabIndex = 3;
			this.label1.Text = "说明:";
			// 
			// frmOptionalArgu
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(400, 253);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.tabControl1);
			this.Controls.Add(this.btnCancel);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Name = "frmOptionalArgu";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "选项";
			this.tabControl1.ResumeLayout(false);
			this.tpgGeneral.ResumeLayout(false);
			this.tpgDebug.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#region 变量区

		private ConfigArgus _argu;

		public ConfigArgus ArguObject
		{
			get
			{
				return this._argu;
			}
			set
			{
				this._argu = value;
				//将参数值显示在窗体上
				this.ShowObjInForm();
			}
		}

		#endregion

		#region 功能区

		/// <summary>
		/// 将参数值显示在窗体上的控件中
		/// </summary>
		private void ShowObjInForm()
		{
			if(this._argu == null)
				return;
			this.ckbDebug.Checked = this._argu.Debug;
			this.ckbBackup.Checked = this._argu.AutoBackUp;
			this.ckbAutoExpand.Checked = this._argu.AutoExpandSubTree;
		}
		/// <summary>
		/// 根据控件值更新到参数信息对象
		/// </summary>
		private void UpdateObj()
		{
			this._argu.AutoBackUp = this.ckbBackup.Checked;
			this._argu.AutoExpandSubTree = this.ckbAutoExpand.Checked;
			this._argu.Debug = this.ckbDebug.Checked;
		}
		private void OnOK()
		{
			this.UpdateObj();
			this.Close();
		}

		#endregion

		private void btnOK_Click(object sender, System.EventArgs e)
		{
			this.OnOK();
		}

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

		private void btnClearLogFile_Click(object sender, System.EventArgs e)
		{
			MyTrace.ClearTraceFile();
			MessageBox.Show("日志文件内容已经被清空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
		}

	}
}

⌨️ 快捷键说明

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