C# 技能鉴定 第三单元的题目

用代码来调整或者编辑窗体的方法,这些方法先将它放在这里,相信以后编程中肯定会用得到的。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Test3_3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {


        }
        private void 黑ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.Black;
            this.toolStripStatusLabel1.Text = "黑色";
        }


        private void 白色WToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.White;
            this.toolStripStatusLabel1.Text = "白色";
        }


        private void 紫色PToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.Purple;
            this.toolStripStatusLabel1.Text = "紫色";
        }


        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.Black;
            this.toolStripStatusLabel1.Text = "黑色";
        }


        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.White;
            this.toolStripStatusLabel1.Text = "白色";
        }


        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.pictureBox1.BackColor = Color.Purple;
            this.toolStripStatusLabel1.Text = "紫色";
        }
    }
}


 

Test3_1:
using
System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace test_3._1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void toolStripButton1_Click(object sender, EventArgs e) { } private void 大BToolStripMenuItem_Click(object sender, EventArgs e) { this.Size = new Size(600, 400); this.toolStripStatusLabel1.Text = "大窗体"; } private void 中MToolStripMenuItem_Click(object sender, EventArgs e) { this.Size = new Size(300, 200); this.toolStripStatusLabel1.Text = "中窗体"; } private void 小SToolStripMenuItem_Click(object sender, EventArgs e) { this.Size = new Size(150, 120); this.toolStripStatusLabel1.Text = "小窗体"; } private void toolStripButton1_Click_1(object sender, EventArgs e) { this.Size = new Size(600, 400); this.toolStripStatusLabel1.Text = "大窗体"; } private void toolStripButton2_Click(object sender, EventArgs e) { this.Size = new Size(300, 200); this.toolStripStatusLabel1.Text = "中窗体"; } private void toolStripButton3_Click(object sender, EventArgs e) { this.Size = new Size(150, 120); this.toolStripStatusLabel1.Text = "小窗体"; } } }



Test3_2:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Threading.Tasks;
 9 using System.Windows.Forms;
10 
11 namespace Test3_2
12 {
13     public partial class Form1 : Form
14     {
15         public Form1()
16         {
17             InitializeComponent();
18         }
19 
20         private void 红色RToolStripMenuItem_Click(object sender, EventArgs e)
21         {
22             this.BackColor = Color.Red;
23             this.toolStripStatusLabel1.Text = "红色";
24         }
25 
26         private void 绿色GToolStripMenuItem_Click(object sender, EventArgs e)
27         {
28             this.BackColor = Color.Green;
29             this.toolStripStatusLabel1.Text = "绿色";
30         }
31 
32         private void 蓝色BToolStripMenuItem_Click(object sender, EventArgs e)
33         {
34             this.BackColor = Color.Blue;
35             this.toolStripStatusLabel1.Text = "蓝色";
36         }
37 
38         private void toolStripButton1_Click(object sender, EventArgs e)
39         {
40             this.BackColor = Color.Red;
41             this.toolStripStatusLabel1.Text = "红色";
42         }
43 
44         private void toolStripButton2_Click(object sender, EventArgs e)
45         {
46             this.BackColor = Color.Green;
47             this.toolStripStatusLabel1.Text = "绿色";
48         }
49 
50         private void toolStripButton3_Click(object sender, EventArgs e)
51         {
52             this.BackColor = Color.Blue;
53             this.toolStripStatusLabel1.Text = "蓝色";
54         }
55     }
56 }
 
原文地址:https://www.cnblogs.com/chenpengzhou/p/7560864.html