C#认证3章

主菜单控件 MainMenu

工具栏控件 toolStrip

状态栏控件 statusStrip

Size、Location属性需要new,而其他不需要

单击菜单项的menuItem事件后,状态面板中显示相应的窗体尺寸信息

this.toolStripStatusLabel1.Text= "大窗体";

 private void Form1_Load(object sender, EventArgs e)
        {
            this.Size = new Size(300, 200);
        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            this.Size = new Size(600, 400);
            this.toolStripStatusLabel1.Text= "大窗体";
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            this.Size = new Size(300, 200);
            this.toolStripStatusLabel1.Text = "中窗体";
        }

        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            this.Size = new Size(150, 120);
            this.toolStripStatusLabel1.Text = "小窗体";
        }

 

 

背景色

this.BackColor = Color.Red;

前景色

this.ForeColor = Color.Black;

通过主菜单和工具按钮改变文本内容

通过lable.属性来改变

posted @ 2017-09-25 23:11  Guara  阅读(95)  评论(0编辑  收藏  举报