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

📄 encodingselect.cs

📁 c文本编辑器源码.............
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Editor
{
	/// <summary>
	/// EncodingSelect 的摘要说明。
	/// </summary>
	public class EncodingSelect : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupEncoding;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.RadioButton radioGB;
		private System.Windows.Forms.RadioButton radioUTF7;
		private System.Windows.Forms.RadioButton radioUTF8;
		private System.Windows.Forms.RadioButton radioASCII;
		private System.Windows.Forms.RadioButton radioOthers;
		private System.Windows.Forms.RadioButton radioUni;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

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

			//
			// 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()
		{
			this.groupEncoding = new System.Windows.Forms.GroupBox();
			this.radioUni = new System.Windows.Forms.RadioButton();
			this.radioOthers = new System.Windows.Forms.RadioButton();
			this.radioASCII = new System.Windows.Forms.RadioButton();
			this.radioUTF8 = new System.Windows.Forms.RadioButton();
			this.radioUTF7 = new System.Windows.Forms.RadioButton();
			this.radioGB = new System.Windows.Forms.RadioButton();
			this.btnOK = new System.Windows.Forms.Button();
			this.groupEncoding.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupEncoding
			// 
			this.groupEncoding.Controls.Add(this.radioUni);
			this.groupEncoding.Controls.Add(this.radioOthers);
			this.groupEncoding.Controls.Add(this.radioASCII);
			this.groupEncoding.Controls.Add(this.radioUTF8);
			this.groupEncoding.Controls.Add(this.radioUTF7);
			this.groupEncoding.Controls.Add(this.radioGB);
			this.groupEncoding.Location = new System.Drawing.Point(8, 8);
			this.groupEncoding.Name = "groupEncoding";
			this.groupEncoding.Size = new System.Drawing.Size(160, 104);
			this.groupEncoding.TabIndex = 0;
			this.groupEncoding.TabStop = false;
			this.groupEncoding.Text = "请选择文件使用的编码";
			// 
			// radioUni
			// 
			this.radioUni.Location = new System.Drawing.Point(80, 48);
			this.radioUni.Name = "radioUni";
			this.radioUni.Size = new System.Drawing.Size(72, 24);
			this.radioUni.TabIndex = 5;
			this.radioUni.Text = "Unicode";
			// 
			// radioOthers
			// 
			this.radioOthers.Location = new System.Drawing.Point(80, 72);
			this.radioOthers.Name = "radioOthers";
			this.radioOthers.Size = new System.Drawing.Size(64, 24);
			this.radioOthers.TabIndex = 4;
			this.radioOthers.Text = "其他";
			// 
			// radioASCII
			// 
			this.radioASCII.Location = new System.Drawing.Point(80, 24);
			this.radioASCII.Name = "radioASCII";
			this.radioASCII.Size = new System.Drawing.Size(64, 24);
			this.radioASCII.TabIndex = 3;
			this.radioASCII.Text = "ASCII";
			// 
			// radioUTF8
			// 
			this.radioUTF8.Location = new System.Drawing.Point(8, 72);
			this.radioUTF8.Name = "radioUTF8";
			this.radioUTF8.Size = new System.Drawing.Size(64, 24);
			this.radioUTF8.TabIndex = 2;
			this.radioUTF8.Text = "UTF8";
			// 
			// radioUTF7
			// 
			this.radioUTF7.Location = new System.Drawing.Point(8, 48);
			this.radioUTF7.Name = "radioUTF7";
			this.radioUTF7.Size = new System.Drawing.Size(72, 24);
			this.radioUTF7.TabIndex = 1;
			this.radioUTF7.Text = "UTF7";
			// 
			// radioGB
			// 
			this.radioGB.Location = new System.Drawing.Point(8, 24);
			this.radioGB.Name = "radioGB";
			this.radioGB.Size = new System.Drawing.Size(64, 24);
			this.radioGB.TabIndex = 0;
			this.radioGB.Text = "GB2312";
			// 
			// btnOK
			// 
			this.btnOK.Location = new System.Drawing.Point(48, 128);
			this.btnOK.Name = "btnOK";
			this.btnOK.TabIndex = 1;
			this.btnOK.Text = "确定";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// EncodingSelect
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(184, 165);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.groupEncoding);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "EncodingSelect";
			this.Text = "编码选择";
			this.Load += new System.EventHandler(this.EncodingSelect_Load);
			this.groupEncoding.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		public System.Text.Encoding Encode = System.Text.Encoding.ASCII;
		private void btnOK_Click(object sender, System.EventArgs e)
		{
			if(this.radioGB.Checked)
			{
				Encode = System.Text.Encoding.GetEncoding("GB2312");
			}
			if(this.radioUTF7.Checked)
			{
				Encode = System.Text.Encoding.UTF7;
			}
			if(this.radioUTF8.Checked)
			{
				Encode = System.Text.Encoding.UTF8;
			}
			if(this.radioASCII.Checked)
			{
				Encode = System.Text.Encoding.ASCII;
			}
			if(this.radioOthers.Checked)
			{
				Encode = System.Text.Encoding.GetEncoding("GB2312");
			}
			if(this.radioUni.Checked)
			{
				Encode = System.Text.Encoding.Unicode;
			}
			this.Close();
		}

		private void EncodingSelect_Load(object sender, System.EventArgs e)
		{
			this.radioGB.Checked = true;
		}
	}
}

⌨️ 快捷键说明

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