C#界面设计之菜单栏的使用

来源:互联网 发布:js隐藏span 编辑:程序博客网 时间:2024/05/16 01:47

这里先给出界面效果图:
这里写图片描述

没有任何触发事件,所以主程序里没有增加代码,下面主要给出控件标注信息的代码:

namespace MenuStrip{    partial class Form1    {        /// <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.components = new System.ComponentModel.Container();            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));            this.menuStrip1 = new System.Windows.Forms.MenuStrip();            this.系统ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();            this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);            this.复制ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.粘贴ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.textBox1 = new System.Windows.Forms.TextBox();            this.toolStrip1 = new System.Windows.Forms.ToolStrip();            this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();            this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();            this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();            this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();            this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();            this.功能1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.功能2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();            this.statusStrip1 = new System.Windows.Forms.StatusStrip();            this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();            this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();            this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();            this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();            this.menuStrip1.SuspendLayout();            this.contextMenuStrip1.SuspendLayout();            this.toolStrip1.SuspendLayout();            this.statusStrip1.SuspendLayout();            this.SuspendLayout();            //             // menuStrip1            //             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.系统ToolStripMenuItem,            this.帮助ToolStripMenuItem});            this.menuStrip1.Location = new System.Drawing.Point(0, 0);            this.menuStrip1.Name = "menuStrip1";            this.menuStrip1.Size = new System.Drawing.Size(281, 25);            this.menuStrip1.TabIndex = 0;            this.menuStrip1.Text = "menuStrip1";            //             // 系统ToolStripMenuItem            //             this.系统ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.设置ToolStripMenuItem,            this.toolStripSeparator1,            this.退出ToolStripMenuItem});            this.系统ToolStripMenuItem.Name = "系统ToolStripMenuItem";            this.系统ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);            this.系统ToolStripMenuItem.Text = "系统";            //             // 设置ToolStripMenuItem            //             this.设置ToolStripMenuItem.Name = "设置ToolStripMenuItem";            this.设置ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);            this.设置ToolStripMenuItem.Text = "设置";            //             // toolStripSeparator1            //             this.toolStripSeparator1.Name = "toolStripSeparator1";            this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);            //             // 退出ToolStripMenuItem            //             this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";            this.退出ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);            this.退出ToolStripMenuItem.Text = "退出";            //             // 帮助ToolStripMenuItem            //             this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.关于ToolStripMenuItem});            this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";            this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);            this.帮助ToolStripMenuItem.Text = "帮助";            //             // 关于ToolStripMenuItem            //             this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";            this.关于ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);            this.关于ToolStripMenuItem.Text = "关于...";            //             // contextMenuStrip1            //             this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.复制ToolStripMenuItem,            this.粘贴ToolStripMenuItem});            this.contextMenuStrip1.Name = "contextMenuStrip1";            this.contextMenuStrip1.Size = new System.Drawing.Size(101, 48);            //             // 复制ToolStripMenuItem            //             this.复制ToolStripMenuItem.Name = "复制ToolStripMenuItem";            this.复制ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);            this.复制ToolStripMenuItem.Text = "复制";            //             // 粘贴ToolStripMenuItem            //             this.粘贴ToolStripMenuItem.Name = "粘贴ToolStripMenuItem";            this.粘贴ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);            this.粘贴ToolStripMenuItem.Text = "粘贴";            //             // textBox1            //             this.textBox1.ContextMenuStrip = this.contextMenuStrip1;            this.textBox1.Location = new System.Drawing.Point(12, 51);            this.textBox1.Multiline = true;            this.textBox1.Name = "textBox1";            this.textBox1.Size = new System.Drawing.Size(257, 162);            this.textBox1.TabIndex = 2;            //             // toolStrip1            //             this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.toolStripButton1,            this.toolStripSeparator2,            this.toolStripButton2,            this.toolStripButton3,            this.toolStripSeparator3,            this.toolStripButton4,            this.toolStripSeparator4,            this.toolStripDropDownButton1,            this.toolStripButton5});            this.toolStrip1.Location = new System.Drawing.Point(0, 25);            this.toolStrip1.Name = "toolStrip1";            this.toolStrip1.Size = new System.Drawing.Size(281, 25);            this.toolStrip1.TabIndex = 3;            this.toolStrip1.Text = "toolStrip1";            //             // toolStripButton1            //             this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;            this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));            this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripButton1.Name = "toolStripButton1";            this.toolStripButton1.Size = new System.Drawing.Size(36, 22);            this.toolStripButton1.Text = "退出";            //             // toolStripSeparator2            //             this.toolStripSeparator2.Name = "toolStripSeparator2";            this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);            //             // toolStripButton2            //             this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;            this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));            this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripButton2.Name = "toolStripButton2";            this.toolStripButton2.Size = new System.Drawing.Size(36, 22);            this.toolStripButton2.Text = "复制";            //             // toolStripButton3            //             this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;            this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));            this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripButton3.Name = "toolStripButton3";            this.toolStripButton3.Size = new System.Drawing.Size(36, 22);            this.toolStripButton3.Text = "粘贴";            //             // toolStripSeparator3            //             this.toolStripSeparator3.Name = "toolStripSeparator3";            this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);            //             // toolStripButton4            //             this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;            this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image")));            this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripButton4.Name = "toolStripButton4";            this.toolStripButton4.Size = new System.Drawing.Size(36, 22);            this.toolStripButton4.Text = "关于";            //             // toolStripSeparator4            //             this.toolStripSeparator4.Name = "toolStripSeparator4";            this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);            //             // toolStripDropDownButton1            //             this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;            this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.功能1ToolStripMenuItem,            this.功能2ToolStripMenuItem});            this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));            this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";            this.toolStripDropDownButton1.Size = new System.Drawing.Size(45, 22);            this.toolStripDropDownButton1.Text = "更多";            //             // 功能1ToolStripMenuItem            //             this.功能1ToolStripMenuItem.Name = "功能1ToolStripMenuItem";            this.功能1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);            this.功能1ToolStripMenuItem.Text = "功能1";            //             // 功能2ToolStripMenuItem            //             this.功能2ToolStripMenuItem.Name = "功能2ToolStripMenuItem";            this.功能2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);            this.功能2ToolStripMenuItem.Text = "功能2";            //             // statusStrip1            //             this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {            this.toolStripStatusLabel1,            this.toolStripProgressBar1,            this.toolStripStatusLabel2});            this.statusStrip1.Location = new System.Drawing.Point(0, 224);            this.statusStrip1.Name = "statusStrip1";            this.statusStrip1.Size = new System.Drawing.Size(281, 22);            this.statusStrip1.TabIndex = 4;            this.statusStrip1.Text = "statusStrip1";            //             // toolStripStatusLabel1            //             this.toolStripStatusLabel1.BorderStyle = System.Windows.Forms.Border3DStyle.RaisedInner;            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";            this.toolStripStatusLabel1.Size = new System.Drawing.Size(53, 17);            this.toolStripStatusLabel1.Text = "运行中...";            //             // toolStripProgressBar1            //             this.toolStripProgressBar1.Name = "toolStripProgressBar1";            this.toolStripProgressBar1.Size = new System.Drawing.Size(150, 16);            this.toolStripProgressBar1.Value = 50;            //             // toolStripButton5            //             this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;            this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image")));            this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta;            this.toolStripButton5.Name = "toolStripButton5";            this.toolStripButton5.Size = new System.Drawing.Size(23, 22);            this.toolStripButton5.Text = "toolStripButton5";            //             // toolStripStatusLabel2            //             this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";            this.toolStripStatusLabel2.Size = new System.Drawing.Size(131, 17);            this.toolStripStatusLabel2.Text = "toolStripStatusLabel2";            //             // Form1            //             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;            this.ClientSize = new System.Drawing.Size(281, 246);            this.Controls.Add(this.textBox1);            this.Controls.Add(this.toolStrip1);            this.Controls.Add(this.menuStrip1);            this.Controls.Add(this.statusStrip1);            this.MainMenuStrip = this.menuStrip1;            this.Name = "Form1";            this.Text = "菜单实例";            this.menuStrip1.ResumeLayout(false);            this.menuStrip1.PerformLayout();            this.contextMenuStrip1.ResumeLayout(false);            this.toolStrip1.ResumeLayout(false);            this.toolStrip1.PerformLayout();            this.statusStrip1.ResumeLayout(false);            this.statusStrip1.PerformLayout();            this.ResumeLayout(false);            this.PerformLayout();        }        #endregion        private System.Windows.Forms.MenuStrip menuStrip1;        private System.Windows.Forms.ToolStripMenuItem 系统ToolStripMenuItem;        private System.Windows.Forms.ToolStripMenuItem 设置ToolStripMenuItem;        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;        private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem;        private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem;        private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem;        private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;        private System.Windows.Forms.ToolStripMenuItem 复制ToolStripMenuItem;        private System.Windows.Forms.ToolStripMenuItem 粘贴ToolStripMenuItem;        private System.Windows.Forms.TextBox textBox1;        private System.Windows.Forms.ToolStrip toolStrip1;        private System.Windows.Forms.ToolStripButton toolStripButton1;        private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;        private System.Windows.Forms.ToolStripButton toolStripButton2;        private System.Windows.Forms.ToolStripButton toolStripButton3;        private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;        private System.Windows.Forms.ToolStripButton toolStripButton4;        private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;        private System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1;        private System.Windows.Forms.ToolStripMenuItem 功能1ToolStripMenuItem;        private System.Windows.Forms.ToolStripMenuItem 功能2ToolStripMenuItem;        private System.Windows.Forms.StatusStrip statusStrip1;        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;        private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;        private System.Windows.Forms.ToolStripButton toolStripButton5;        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;    }}
0 0