C#winform 自定义模仿MessageBox的对话框

    public partial class MesBox : Form
    {
        int _maxWidth = 802;
        int _maxHeight = 704;
        int _btnAllow;

        Dictionary<Keys, Button> _dictKBtn = new Dictionary<Keys, Button>();
        List<Button> _listBtn = new List<Button>();

        Point downPoint;
        void Control_MouseDown(object sender, MouseEventArgs e)
        {
            downPoint = new Point(e.X, e.Y);
        }

        void Control_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Location = new Point(this.Location.X + e.X - downPoint.X, this.Location.Y + e.Y - downPoint.Y);
            }
        }

        string _text, _caption;
        MessageBoxButtons _boxBtn;
        MessageBoxIcon _boxIcon;
        MessageBoxDefaultButton _defaultBtn;

        MesBox(string text, string caption = "信息", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button3)
        {
            InitializeComponent();
            _btnAllow = this.Height - this.panelText.Location.Y - this.panelText.Height;
            _dictKBtn[Keys.Escape] = this.btnClose;
            _listBtn = new List<Button>() { this.button1, this.button2, this.button3 };

            _text = text;
            _caption = caption;
            _boxBtn = buttons;
            _boxIcon = icon;
            _defaultBtn = defaultButton;
        }

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

        void showNew(string text, string caption = "信息", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button3)
        {
            if (icon == MessageBoxIcon.None)
            {
                this.lbText.Location = this.pictureBox1.Location;
                this.pictureBox1.Width = 0;
            }

            setBtn(buttons, defaultButton, icon);

            this.lbHeadText.Text = caption.Replace('\n', ' ');
            int w = this.btnClose.Location.X;
            if (this.lbHeadText.Width > w)
            {
                this.Width = Math.Min(this.lbHeadText.Width + this.Width - w, _maxWidth);
                this.panelClose.BringToFront();
                //this.lbHeadText.MaximumSize = new Size(this.btnClose.Location.X - 20, 0);
            }

            this.lbText.Text = text;
            if (this.lbText.Width + this.pictureBox1.Width > this.panelText.Width)
            {
                this.Width = Math.Min(this.lbText.Width + this.pictureBox1.Width + this.Width - this.panelText.Width, _maxWidth);
                if (this.Width == _maxWidth)
                {
                    this.lbText.MaximumSize = new Size(this.panelText.Width - this.pictureBox1.Width, 0);
                }
            }
            if (this.lbText.Height > this.panelText.Height)
            {
                this.Height = Math.Min(this.lbText.Height + this.panelText.Location.Y + _btnAllow, _maxHeight);
            }

            if (this.Height == _maxHeight)
            {
                this.lbText.Location = new Point(this.lbText.Location.X, 10);
                Label lb = new Label();
                lb.Visible = true;
                lb.Name = "LLL";
                lb.Size = new Size(1, 1);
                lb.Location = new Point(0, this.lbText.Location.Y + this.lbText.Height + 2);
                this.panelText.Controls.Add(lb);
            }
            else
            {
                CenterCtr(this.lbText, false, true);
            }

            this.Location = new Point((SystemInformation.PrimaryMonitorSize.Width - this.Width) / 2, (SystemInformation.PrimaryMonitorSize.Height - this.Height) / 2);
        }

        void setBtn(MessageBoxButtons boxBtn, MessageBoxDefaultButton defaultBtn, MessageBoxIcon boxIcon)
        {
            switch (boxBtn)
            {
                case MessageBoxButtons.OK:
                    this.button1.Visible = false;
                    this.button2.Visible = false;
                    this.button3.Text = "确定";
                    this.button3.DialogResult = DialogResult.OK;
                    this.Size = new Size(200, 160);
                    break;
                case MessageBoxButtons.OKCancel:
                    this.button1.Visible = false;
                    this.button2.Text = "确定";
                    this.button2.DialogResult = DialogResult.OK;
                    this.button3.Text = "取消";
                    this.button3.DialogResult = DialogResult.Cancel;
                    break;
                case MessageBoxButtons.YesNo:
                    this.button1.Visible = false;
                    this.button2.Text = "是(Y)";
                    this.button2.DialogResult = DialogResult.Yes;
                    _dictKBtn[Keys.Y] = this.button2;
                    this.button3.Text = "否(N)";
                    this.button3.DialogResult = DialogResult.No;
                    _dictKBtn[Keys.N] = this.button3;
                    this.btnClose.Enabled = false;
                    break;
                case MessageBoxButtons.YesNoCancel:
                    this.button1.Text = "是(Y)";
                    this.button1.DialogResult = DialogResult.Yes;
                    _dictKBtn[Keys.Y] = this.button1;
                    this.button2.Text = "否(N)";
                    this.button2.DialogResult = DialogResult.No;
                    _dictKBtn[Keys.N] = this.button2;
                    this.button3.Text = "取消";
                    this.button3.DialogResult = DialogResult.Cancel;
                    this.Size = new Size(340, 200);
                    break;
                case MessageBoxButtons.AbortRetryIgnore:
                    this.button1.Text = "中止(A)";
                    this.button1.DialogResult = DialogResult.Abort;
                    _dictKBtn[Keys.A] = this.button1;
                    this.button2.Text = "重试(R)";
                    this.button2.DialogResult = DialogResult.Retry;
                    _dictKBtn[Keys.R] = this.button2;
                    this.button3.Text = "忽略(I)";
                    this.button3.DialogResult = DialogResult.Ignore;
                    _dictKBtn[Keys.I] = this.button3;
                    this.btnClose.Enabled = false;
                    this.Size = new Size(340, 200);
                    break;
                case MessageBoxButtons.RetryCancel:
                    this.button1.Visible = false;
                    this.button2.Text = "重试(R)";
                    this.button2.DialogResult = DialogResult.Retry;
                    _dictKBtn[Keys.R] = this.button2;
                    this.button3.Text = "取消";
                    this.button3.DialogResult = DialogResult.Cancel;
                    break;
            }

            CenterCtr(this.pictureBox1, false, true);
            CenterCtr(this.lbText, false, true);
            _listBtn.RemoveAll(b => !b.Visible);

            Button btnFocus = this.button3;
            switch (defaultBtn)
            {
                case MessageBoxDefaultButton.Button1:
                    if (_listBtn.Count >= 1)
                    {
                        btnFocus = _listBtn[0];
                    }
                    break;
                case MessageBoxDefaultButton.Button2:
                    if (_listBtn.Count >= 2)
                    {
                        btnFocus = _listBtn[1];
                    }
                    break;
                case MessageBoxDefaultButton.Button3:
                    if (_listBtn.Count >= 3)
                    {
                        btnFocus = _listBtn[2];
                    }
                    break;
            }
            this.BeginInvoke((MethodInvoker)delegate
            {
                btnFocus.Focus();
                btnFocus.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
            });

            switch (boxIcon)
            {
                case MessageBoxIcon.Information:
                    this.pictureBox1.Image = Properties.Resources.Info;
                    break;
                case MessageBoxIcon.Error:
                    this.pictureBox1.Image = Properties.Resources.Error;
                    break;
                case MessageBoxIcon.Warning:
                    this.pictureBox1.Image = Properties.Resources.Warn;
                    break;
                case MessageBoxIcon.Question:
                    this.pictureBox1.Image = Properties.Resources.Question;
                    break;
                case MessageBoxIcon.None:
                    this.pictureBox1.Image = null;
                    break;
            }
        }

        bool CenterCtr(Control ctr, bool isLR, bool isUD)
        {
            Control pCtr = ctr.Parent;
            int x = isLR ? ((pCtr.Width - ctr.Width) / 2) : ctr.Location.X;
            int y = isUD ? ((pCtr.Height - ctr.Height) / 2) : ctr.Location.Y;
            ctr.Location = new Point(x, y);
            return true;
        }

        private void btnClose_MouseEnter(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            btn.ForeColor = Color.Red;
        }

        private void btnClose_MouseLeave(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            btn.ForeColor = Color.Black;
        }

        private void MesBox_Load(object sender, EventArgs e)
        {
            showNew(_text, _caption, _boxBtn, _boxIcon, _defaultBtn);
        }

        private void button1_MouseEnter(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
        }

        private void button1_MouseLeave(object sender, EventArgs e)
        {
            Button btn = sender as Button;
            if (!btn.Focused)
            {
                btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(173)))), ((int)(((byte)(173)))));
            }
        }

        private void MesBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (_dictKBtn.ContainsKey(e.KeyCode))
            {
                _dictKBtn[e.KeyCode].PerformClick();
            }
        }

        public static DialogResult Show(string text, string caption = "信息", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.None, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button3)
        {
            return new MesBox(text, caption, buttons, icon, defaultButton).ShowDialog();
        }

    }
    partial class MesBox
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.panelMain = new System.Windows.Forms.Panel();
            this.panel1 = new System.Windows.Forms.Panel();
            this.button1 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.panelText = new System.Windows.Forms.Panel();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.lbText = new System.Windows.Forms.Label();
            this.panelHead = new System.Windows.Forms.Panel();
            this.panelClose = new System.Windows.Forms.Panel();
            this.btnClose = new System.Windows.Forms.Button();
            this.lbHeadText = new System.Windows.Forms.Label();
            this.panelMain.SuspendLayout();
            this.panel1.SuspendLayout();
            this.panelText.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.panelHead.SuspendLayout();
            this.panelClose.SuspendLayout();
            this.SuspendLayout();
            // 
            // panelMain
            // 
            this.panelMain.BackColor = System.Drawing.Color.White;
            this.panelMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panelMain.Controls.Add(this.panel1);
            this.panelMain.Controls.Add(this.panelText);
            this.panelMain.Controls.Add(this.panelHead);
            this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelMain.Location = new System.Drawing.Point(0, 0);
            this.panelMain.Name = "panelMain";
            this.panelMain.Size = new System.Drawing.Size(260, 180);
            this.panelMain.TabIndex = 0;
            // 
            // panel1
            // 
            this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.panel1.Controls.Add(this.button1);
            this.panel1.Controls.Add(this.button3);
            this.panel1.Controls.Add(this.button2);
            this.panel1.Location = new System.Drawing.Point(0, 130);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(258, 48);
            this.panel1.TabIndex = 7;
            // 
            // button1
            // 
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(225)))), ((int)(((byte)(225)))), ((int)(((byte)(225)))));
            this.button1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(173)))), ((int)(((byte)(173)))));
            this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(241)))), ((int)(((byte)(251)))));
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(-35, 11);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(84, 26);
            this.button1.TabIndex = 9;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MesBox_KeyDown);
            this.button1.MouseEnter += new System.EventHandler(this.button1_MouseEnter);
            this.button1.MouseLeave += new System.EventHandler(this.button1_MouseLeave);
            // 
            // button3
            // 
            this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(225)))), ((int)(((byte)(225)))), ((int)(((byte)(225)))));
            this.button3.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(173)))), ((int)(((byte)(173)))));
            this.button3.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(241)))), ((int)(((byte)(251)))));
            this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button3.Location = new System.Drawing.Point(157, 11);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(84, 26);
            this.button3.TabIndex = 12;
            this.button3.Text = "button3";
            this.button3.UseVisualStyleBackColor = false;
            this.button3.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MesBox_KeyDown);
            this.button3.MouseEnter += new System.EventHandler(this.button1_MouseEnter);
            this.button3.MouseLeave += new System.EventHandler(this.button1_MouseLeave);
            // 
            // button2
            // 
            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(225)))), ((int)(((byte)(225)))), ((int)(((byte)(225)))));
            this.button2.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(173)))), ((int)(((byte)(173)))));
            this.button2.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(241)))), ((int)(((byte)(251)))));
            this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button2.Location = new System.Drawing.Point(61, 11);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(84, 26);
            this.button2.TabIndex = 11;
            this.button2.Text = "button2";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MesBox_KeyDown);
            this.button2.MouseEnter += new System.EventHandler(this.button1_MouseEnter);
            this.button2.MouseLeave += new System.EventHandler(this.button1_MouseLeave);
            // 
            // panelText
            // 
            this.panelText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panelText.AutoScroll = true;
            this.panelText.BackColor = System.Drawing.Color.Transparent;
            this.panelText.Controls.Add(this.pictureBox1);
            this.panelText.Controls.Add(this.lbText);
            this.panelText.Location = new System.Drawing.Point(12, 30);
            this.panelText.Name = "panelText";
            this.panelText.Size = new System.Drawing.Size(233, 98);
            this.panelText.TabIndex = 10;
            // 
            // pictureBox1
            // 
            this.pictureBox1.Image = Properties.Resources.Info;
            this.pictureBox1.InitialImage = null;
            this.pictureBox1.Location = new System.Drawing.Point(-1, 33);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(40, 32);
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            this.pictureBox1.TabIndex = 6;
            this.pictureBox1.TabStop = false;
            // 
            // lbText
            // 
            this.lbText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lbText.AutoSize = true;
            this.lbText.BackColor = System.Drawing.Color.Transparent;
            this.lbText.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lbText.Location = new System.Drawing.Point(43, 42);
            this.lbText.Name = "lbText";
            this.lbText.Size = new System.Drawing.Size(14, 15);
            this.lbText.TabIndex = 5;
            this.lbText.Text = "0";
            this.lbText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // panelHead
            // 
            this.panelHead.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panelHead.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.panelHead.Controls.Add(this.panelClose);
            this.panelHead.Controls.Add(this.lbHeadText);
            this.panelHead.Location = new System.Drawing.Point(0, 0);
            this.panelHead.Name = "panelHead";
            this.panelHead.Size = new System.Drawing.Size(258, 24);
            this.panelHead.TabIndex = 0;
            this.panelHead.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Control_MouseDown);
            this.panelHead.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Control_MouseMove);
            // 
            // panelClose
            // 
            this.panelClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.panelClose.Controls.Add(this.btnClose);
            this.panelClose.Location = new System.Drawing.Point(219, 0);
            this.panelClose.Name = "panelClose";
            this.panelClose.Size = new System.Drawing.Size(39, 24);
            this.panelClose.TabIndex = 33;
            // 
            // btnClose
            // 
            this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.FlatAppearance.BorderSize = 0;
            this.btnClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
            this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnClose.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnClose.ForeColor = System.Drawing.Color.Black;
            this.btnClose.Location = new System.Drawing.Point(10, 0);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(26, 24);
            this.btnClose.TabIndex = 32;
            this.btnClose.Text = "×";
            this.btnClose.UseVisualStyleBackColor = true;
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            this.btnClose.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MesBox_KeyDown);
            this.btnClose.MouseEnter += new System.EventHandler(this.btnClose_MouseEnter);
            this.btnClose.MouseLeave += new System.EventHandler(this.btnClose_MouseLeave);
            // 
            // lbHeadText
            // 
            this.lbHeadText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lbHeadText.AutoEllipsis = true;
            this.lbHeadText.AutoSize = true;
            this.lbHeadText.BackColor = System.Drawing.Color.Transparent;
            this.lbHeadText.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lbHeadText.Location = new System.Drawing.Point(4, 6);
            this.lbHeadText.Name = "lbHeadText";
            this.lbHeadText.Size = new System.Drawing.Size(29, 12);
            this.lbHeadText.TabIndex = 2;
            this.lbHeadText.Text = "提示";
            this.lbHeadText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.lbHeadText.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Control_MouseDown);
            this.lbHeadText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Control_MouseMove);
            // 
            // MesBox
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(260, 180);
            this.Controls.Add(this.panelMain);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "MesBox";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.MesBox_Load);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MesBox_KeyDown);
            this.panelMain.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.panelText.ResumeLayout(false);
            this.panelText.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.panelHead.ResumeLayout(false);
            this.panelHead.PerformLayout();
            this.panelClose.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panelMain;
        private System.Windows.Forms.Panel panelHead;
        private System.Windows.Forms.Label lbHeadText;
        private System.Windows.Forms.Button btnClose;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Panel panelText;
        private System.Windows.Forms.Label lbText;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Panel panelClose;
    }
发布了31 篇原创文章 · 获赞 8 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/breakbridge/article/details/101671486