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

📄 mainform.cs

📁 c#的学习资料 书上的东西 很难找到的啊
💻 CS
📖 第 1 页 / 共 4 页
字号:
namespace MessageBoxBuilder
{
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
	using System.IO;
	using System.Threading;

    /// <summary>
    ///    Summary description for Form1.
    /// </summary>
    public class MainForm : System.Windows.Forms.Form
    {
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.Button btnPreview;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.TextBox txtCaption;
		private System.Windows.Forms.GroupBox grpCaption;
		private System.Windows.Forms.TextBox txtMessage;
		private System.Windows.Forms.GroupBox grpMessage;

		private MessageBoxButtons btnStyle;
		private MessageBoxIcon iconStyle;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.ListBox listBox1;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.CheckBox cbnVisualCSharp;
		private System.Windows.Forms.CheckBox cbnVisualCPP;
		private System.Windows.Forms.CheckBox cbnVisualBasic;
		private System.Windows.Forms.CheckBox cbnUseMFC;
		private System.Windows.Forms.GroupBox grpButtons;
		private System.Windows.Forms.GroupBox grpDefault;
		private System.Windows.Forms.Button btnDefault3;
		private System.Windows.Forms.Button btnDefault2;
		private System.Windows.Forms.Button btnDefault1;
		private System.Windows.Forms.ComboBox cboButtons;
		private System.Windows.Forms.GroupBox grpSend;
		private System.Windows.Forms.RadioButton rdoFile;
		private System.Windows.Forms.RadioButton rdoClipboard;
		private System.Windows.Forms.GroupBox grpOptions;
		private System.Windows.Forms.CheckBox cbnDeclareIt;
		private System.Windows.Forms.CheckBox cbnBuildSwitch;
		private System.Windows.Forms.Label lblVariable;
		private System.Windows.Forms.CheckBox cbnUseReturnVar;
		private System.Windows.Forms.TextBox txtVariable;
		private System.Windows.Forms.GroupBox grpCode;
		private System.Windows.Forms.TextBox txtCode;
		private System.Windows.Forms.GroupBox grpSample;
		private System.Windows.Forms.Button btnSample4;
		private System.Windows.Forms.Button btnSample2;
		private System.Windows.Forms.Button btnSample5;
		private System.Windows.Forms.Button btnSample3;
		private System.Windows.Forms.Button btnSample1;
		private System.Windows.Forms.Label lblSampleText;
		private System.Windows.Forms.PictureBox pbIcon;
		private System.Windows.Forms.Label lblCaption;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.CheckBox cbnDefault3;
		private System.Windows.Forms.CheckBox cbnDefault2;
		private System.Windows.Forms.CheckBox cbnDefault1;
		private MessageBoxDefaultButton btnDefault;

        public MainForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();			

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
			InitForm ();
        }

        /// <summary>
        ///    Clean up any resources being used.
        /// </summary>
        public override void Dispose()
        {
            base.Dispose();
			if (components != null)
	            components.Dispose();
        }

        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
			this.btnSample4 = new System.Windows.Forms.Button();
			this.btnSample5 = new System.Windows.Forms.Button();
			this.txtCaption = new System.Windows.Forms.TextBox();
			this.btnSample1 = new System.Windows.Forms.Button();
			this.btnSample2 = new System.Windows.Forms.Button();
			this.btnSample3 = new System.Windows.Forms.Button();
			this.cbnBuildSwitch = new System.Windows.Forms.CheckBox();
			this.pbIcon = new System.Windows.Forms.PictureBox();
			this.grpSend = new System.Windows.Forms.GroupBox();
			this.rdoFile = new System.Windows.Forms.RadioButton();
			this.rdoClipboard = new System.Windows.Forms.RadioButton();
			this.cbnVisualCSharp = new System.Windows.Forms.CheckBox();
			this.cbnDefault2 = new System.Windows.Forms.CheckBox();
			this.cbnDefault3 = new System.Windows.Forms.CheckBox();
			this.lblSampleText = new System.Windows.Forms.Label();
			this.grpCaption = new System.Windows.Forms.GroupBox();
			this.btnCancel = new System.Windows.Forms.Button();
			this.grpCode = new System.Windows.Forms.GroupBox();
			this.txtCode = new System.Windows.Forms.TextBox();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.btnOK = new System.Windows.Forms.Button();
			this.listBox1 = new System.Windows.Forms.ListBox();
			this.grpMessage = new System.Windows.Forms.GroupBox();
			this.txtMessage = new System.Windows.Forms.TextBox();
			this.cbnUseMFC = new System.Windows.Forms.CheckBox();
			this.cbnDeclareIt = new System.Windows.Forms.CheckBox();
			this.btnDefault3 = new System.Windows.Forms.Button();
			this.lblCaption = new System.Windows.Forms.Label();
			this.lblVariable = new System.Windows.Forms.Label();
			this.btnPreview = new System.Windows.Forms.Button();
			this.cbnVisualCPP = new System.Windows.Forms.CheckBox();
			this.cbnDefault1 = new System.Windows.Forms.CheckBox();
			this.btnDefault1 = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.btnDefault2 = new System.Windows.Forms.Button();
			this.cbnUseReturnVar = new System.Windows.Forms.CheckBox();
			this.txtVariable = new System.Windows.Forms.TextBox();
			this.grpDefault = new System.Windows.Forms.GroupBox();
			this.grpButtons = new System.Windows.Forms.GroupBox();
			this.cboButtons = new System.Windows.Forms.ComboBox();
			this.grpOptions = new System.Windows.Forms.GroupBox();
			this.cbnVisualBasic = new System.Windows.Forms.CheckBox();
			this.grpSample = new System.Windows.Forms.GroupBox();
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.grpSend.SuspendLayout();
			this.grpCaption.SuspendLayout();
			this.grpCode.SuspendLayout();
			this.grpMessage.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.grpDefault.SuspendLayout();
			this.grpButtons.SuspendLayout();
			this.grpOptions.SuspendLayout();
			this.grpSample.SuspendLayout();
			this.SuspendLayout();
			// 
			// btnSample4
			// 
			this.btnSample4.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSample4.Location = new System.Drawing.Point(168, 154);
			this.btnSample4.Name = "btnSample4";
			this.btnSample4.Size = new System.Drawing.Size(57, 18);
			this.btnSample4.TabIndex = 4;
			this.btnSample4.Text = "button5";
			this.btnSample4.Visible = false;
			// 
			// btnSample5
			// 
			this.btnSample5.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSample5.Location = new System.Drawing.Point(205, 154);
			this.btnSample5.Name = "btnSample5";
			this.btnSample5.Size = new System.Drawing.Size(57, 18);
			this.btnSample5.TabIndex = 4;
			this.btnSample5.Text = "button3";
			this.btnSample5.Visible = false;
			// 
			// txtCaption
			// 
			this.txtCaption.Location = new System.Drawing.Point(9, 24);
			this.txtCaption.Name = "txtCaption";
			this.txtCaption.Size = new System.Drawing.Size(317, 20);
			this.txtCaption.TabIndex = 0;
			this.txtCaption.Text = "";
			this.txtCaption.TextChanged += new System.EventHandler(this.txtCaption_TextChanged);
			// 
			// btnSample1
			// 
			this.btnSample1.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSample1.Location = new System.Drawing.Point(56, 154);
			this.btnSample1.Name = "btnSample1";
			this.btnSample1.Size = new System.Drawing.Size(56, 18);
			this.btnSample1.TabIndex = 4;
			this.btnSample1.Text = "button1";
			this.btnSample1.Visible = false;
			// 
			// btnSample2
			// 
			this.btnSample2.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSample2.Location = new System.Drawing.Point(93, 154);
			this.btnSample2.Name = "btnSample2";
			this.btnSample2.Size = new System.Drawing.Size(57, 18);
			this.btnSample2.TabIndex = 4;
			this.btnSample2.Text = "button4";
			this.btnSample2.Visible = false;
			// 
			// btnSample3
			// 
			this.btnSample3.Font = new System.Drawing.Font("Arial", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnSample3.Location = new System.Drawing.Point(131, 154);
			this.btnSample3.Name = "btnSample3";
			this.btnSample3.Size = new System.Drawing.Size(56, 18);
			this.btnSample3.TabIndex = 4;
			this.btnSample3.Text = "OK";
			// 
			// cbnBuildSwitch
			// 
			this.cbnBuildSwitch.Enabled = false;
			this.cbnBuildSwitch.Location = new System.Drawing.Point(22, 104);
			this.cbnBuildSwitch.Name = "cbnBuildSwitch";
			this.cbnBuildSwitch.Size = new System.Drawing.Size(175, 16);
			this.cbnBuildSwitch.TabIndex = 4;
			this.cbnBuildSwitch.Text = "Build Switch/Conditional";
			this.cbnBuildSwitch.CheckedChanged += new System.EventHandler(this.OnMessageBoxChanged);
			// 
			// pbIcon
			// 
			this.pbIcon.Image = ((System.Drawing.Bitmap)(resources.GetObject("pbIcon.Image")));
			this.pbIcon.Location = new System.Drawing.Point(18, 75);
			this.pbIcon.Name = "pbIcon";
			this.pbIcon.Size = new System.Drawing.Size(38, 37);
			this.pbIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.pbIcon.TabIndex = 2;
			this.pbIcon.TabStop = false;
			this.pbIcon.Visible = false;
			// 
			// grpSend
			// 
			this.grpSend.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.rdoFile,
																				  this.rdoClipboard});
			this.grpSend.Location = new System.Drawing.Point(544, 264);
			this.grpSend.Name = "grpSend";
			this.grpSend.Size = new System.Drawing.Size(208, 56);
			this.grpSend.TabIndex = 9;
			this.grpSend.TabStop = false;
			this.grpSend.Text = "Send To";
			// 
			// rdoFile
			// 
			this.rdoFile.Location = new System.Drawing.Point(141, 19);
			this.rdoFile.Name = "rdoFile";
			this.rdoFile.Size = new System.Drawing.Size(59, 24);
			this.rdoFile.TabIndex = 1;
			this.rdoFile.Text = "File";
			// 
			// rdoClipboard
			// 
			this.rdoClipboard.Checked = true;
			this.rdoClipboard.Location = new System.Drawing.Point(17, 19);
			this.rdoClipboard.Name = "rdoClipboard";
			this.rdoClipboard.Size = new System.Drawing.Size(94, 24);
			this.rdoClipboard.TabIndex = 0;
			this.rdoClipboard.TabStop = true;
			this.rdoClipboard.Text = "Clipboard";
			// 
			// cbnVisualCSharp
			// 
			this.cbnVisualCSharp.AutoCheck = false;
			this.cbnVisualCSharp.Checked = true;
			this.cbnVisualCSharp.CheckState = System.Windows.Forms.CheckState.Checked;
			this.cbnVisualCSharp.Location = new System.Drawing.Point(22, 16);
			this.cbnVisualCSharp.Name = "cbnVisualCSharp";
			this.cbnVisualCSharp.Size = new System.Drawing.Size(102, 15);
			this.cbnVisualCSharp.TabIndex = 14;
			this.cbnVisualCSharp.Text = "Visual C#";
			this.cbnVisualCSharp.Click += new System.EventHandler(this.OnLanguageChanged);
			// 
			// cbnDefault2
			// 
			this.cbnDefault2.AutoCheck = false;
			this.cbnDefault2.Location = new System.Drawing.Point(34, 75);
			this.cbnDefault2.Name = "cbnDefault2";
			this.cbnDefault2.Size = new System.Drawing.Size(17, 18);
			this.cbnDefault2.TabIndex = 1;
			this.cbnDefault2.Visible = false;
			this.cbnDefault2.Click += new System.EventHandler(this.btnDefault2_Clicked);
			// 
			// cbnDefault3
			// 
			this.cbnDefault3.AutoCheck = false;
			this.cbnDefault3.Location = new System.Drawing.Point(34, 112);
			this.cbnDefault3.Name = "cbnDefault3";
			this.cbnDefault3.Size = new System.Drawing.Size(17, 17);
			this.cbnDefault3.TabIndex = 2;
			this.cbnDefault3.Visible = false;
			this.cbnDefault3.Click += new System.EventHandler(this.btnDefault3_Clicked);
			// 
			// lblSampleText
			// 
			this.lblSampleText.Location = new System.Drawing.Point(75, 56);
			this.lblSampleText.Name = "lblSampleText";
			this.lblSampleText.Size = new System.Drawing.Size(197, 94);
			this.lblSampleText.TabIndex = 3;
			this.lblSampleText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// grpCaption
			// 
			this.grpCaption.Controls.AddRange(new System.Windows.Forms.Control[] {
																					 this.txtCaption});
			this.grpCaption.Location = new System.Drawing.Point(18, 56);
			this.grpCaption.Name = "grpCaption";
			this.grpCaption.Size = new System.Drawing.Size(340, 65);
			this.grpCaption.TabIndex = 6;
			this.grpCaption.TabStop = false;
			this.grpCaption.Text = "Caption";
			// 
			// btnCancel
			// 
			this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnCancel.Location = new System.Drawing.Point(592, 504);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(103, 28);
			this.btnCancel.TabIndex = 8;
			this.btnCancel.Text = "Cancel";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// grpCode
			// 
			this.grpCode.Controls.AddRange(new System.Windows.Forms.Control[] {
																				  this.txtCode});
			this.grpCode.Location = new System.Drawing.Point(232, 328);
			this.grpCode.Name = "grpCode";
			this.grpCode.Size = new System.Drawing.Size(520, 169);
			this.grpCode.TabIndex = 4;
			this.grpCode.TabStop = false;
			this.grpCode.Text = "Generated Code";
			// 
			// txtCode
			// 
			this.txtCode.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtCode.Location = new System.Drawing.Point(5, 22);
			this.txtCode.Multiline = true;
			this.txtCode.Name = "txtCode";
			this.txtCode.ReadOnly = true;
			this.txtCode.ScrollBars = System.Windows.Forms.ScrollBars.Both;
			this.txtCode.Size = new System.Drawing.Size(491, 137);
			this.txtCode.TabIndex = 0;
			this.txtCode.Text = "MessageBox.Show();";
			// 
			// pictureBox1
			// 
			this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.pictureBox1.Location = new System.Drawing.Point(9, 22);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(281, 159);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			// 
			// btnOK
			// 
			this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.btnOK.Location = new System.Drawing.Point(456, 504);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(103, 28);
			this.btnOK.TabIndex = 7;
			this.btnOK.Text = "OK";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// listBox1
			// 
			this.listBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
			this.listBox1.Items.AddRange(new object[] {
														  "None",
														  "Information",
														  "Question",
														  "Exclamation",
														  "Error"});
			this.listBox1.Location = new System.Drawing.Point(12, 25);
			this.listBox1.Name = "listBox1";
			this.listBox1.Size = new System.Drawing.Size(188, 154);
			this.listBox1.TabIndex = 0;
			this.listBox1.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.listBox1_MeasureItem);
			this.listBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.OnListBox1DrawItem);
			// 
			// grpMessage
			// 
			this.grpMessage.Controls.AddRange(new System.Windows.Forms.Control[] {
																					 this.txtMessage});
			this.grpMessage.Location = new System.Drawing.Point(360, 0);
			this.grpMessage.Name = "grpMessage";
			this.grpMessage.Size = new System.Drawing.Size(392, 119);
			this.grpMessage.TabIndex = 5;
			this.grpMessage.TabStop = false;
			this.grpMessage.Text = "Message";
			// 
			// txtMessage
			// 
			this.txtMessage.Location = new System.Drawing.Point(12, 20);
			this.txtMessage.Multiline = true;
			this.txtMessage.Name = "txtMessage";
			this.txtMessage.Size = new System.Drawing.Size(372, 89);
			this.txtMessage.TabIndex = 0;
			this.txtMessage.Text = "";

⌨️ 快捷键说明

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