九宫格代码教学提纲

上传人:工**** 文档编号:564209614 上传时间:2023-03-13 格式:DOCX 页数:9 大小:18.82KB
返回 下载 相关 举报
九宫格代码教学提纲_第1页
第1页 / 共9页
九宫格代码教学提纲_第2页
第2页 / 共9页
九宫格代码教学提纲_第3页
第3页 / 共9页
九宫格代码教学提纲_第4页
第4页 / 共9页
九宫格代码教学提纲_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《九宫格代码教学提纲》由会员分享,可在线阅读,更多相关《九宫格代码教学提纲(9页珍藏版)》请在金锄头文库上搜索。

1、九宫格代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespaces 宫格public partial class Forml : Formpublic Form1()InitializeComponent();private void panel1_Paint(object sender, PaintEventArgs

2、 e).private void button1_Click(object sender, EventArgs e).string array = 1, 2, 3, 4, 5, 6, 7, 8, 9 ;Random rd = new Random();for (int i = 0; i 9; i+)int data = rd.Next(0, 9);string tem = arrayi;arrayi = arraydata;arraydata = tem;Label口 lb = new Label label1, label2, label3 , label4, label5, label6

3、,label7, label8, label9 ;lb0.Text = array0;lb1.Text = array1;lb2.Text = array2;lb3.Text = array3;lb4.Text = array4;lb5.Text = array5;lb6.Text = array6;lb7.Text = array7;lb8.Text = array8;for (int i = 0; i 9; i+)lbi.BackColor = Color.LightGreen;int m = rd.Next(0, 9);lbm.BackColor = Color.LightCoral;p

4、rivate void label1_Click(object sender, EventArgs e).if (label2.BackColor = Color.LightCoral)string t = label2.Text;label2.Text = label1.Text;label1.Text = t;label2.BackColor = Color.LightGreen;label1.BackColor = Color.LightCoral;if (label4.BackC010r = Color.LightCoral)string t = label4.Text;label4.

5、Text = label1.Text;label1.Text = t;label4.BackC010r = Color.LightGreen;label1.BackC010r = Color.LightCoral;if (label1.Text = 1 & label2.Text = 2 & label3.Text = 3 & label4.Text = 4 & label5.Text = 5 & label6.Text = 6 & label7.Text = 7 & label8.Text = 8 & label9.Text = 9)MessageBox.Show( A_A You did

6、a great job A_A);this.Close();private void label2_Click(object sender, EventArgs e).if (labell.BackColor = Color.LightCoral)string t = labell.Text;labell.Text = label2.Text;label2.Text = t;label1.BackColor = Color.LightGreen;label2.BackColor = Color.LightCoral;if (label3.BackColor = Color.LightCoral

7、)string t = label3.Text;label3.Text = label2.Text;label2.Text = t;label3.BackColor = Color.LightGreen;label2.BackColor = Color.LightCoral;if (label5.BackC010r = Color.LightCoral)string t = label5.Text;label5.Text = label2.Text;label2.Text = t;label5.BackC010r = Color.LightGreen;label2.BackC010r = Co

8、lor.LightCoral;if (label1.Text = 1 & label2.Text = 2 & label3.Text = 3 & label4.Text = 4 & label5.Text = 5 & label6.Text = 6 & label7.Text = 7 & label8.Text = 8 & label9.Text = 9)MessageBox.Show( A_A You did a great job A_A);this.Close();private void label3_Click(object sender, EventArgs e).if (labe

9、l2.BackC010r = Color.LightCoral)string t = label2.Text;label2.Text = label3.Text;label3.Text = t;label2.BackColor = Color.LightGreen;label3.BackColor = Color.LightCoral;if (label6.BackColor = Color.LightCoral) string t = label6.Text;label6.Text = label3.Text;label3.Text = t;label6.BackColor = Color.

10、LightGreen;label3.BackColor = Color.LightCoral;if (label1.Text = 1 & label2.Text = 2 & label3.Text = 3 & label4.Text = 4 & label5.Text = 5 & label6.Text = 6 & label7.Text = 7 & label8.Text = 8 & label9.Text = 9)MessageBox.Show( A_A You did a great job A_A); this.Close();private void label4_Click(obj

11、ect sender, EventArgs e)if (labell.BackColor = Color.LightCoral) string t = labell.Text;labell.Text = label4.Text;label4.Text = t;labell.BackColor = Color.LightGreen;label4.BackColor = Color.LightCoral;if (label7.BackC010r = Color.LightCoral) string t = label7.Text;label7.Text = label4.Text;label4.T

12、ext = t;label7.BackC010r = Color.LightGreen;label4.BackC010r = Color.LightCoral;if (label5.BackC010r = Color.LightCoral) string t = label5.Text;label5.Text = label4.Text; label4.Text = t;label5.BackColor = Color.LightGreen;label4.BackColor = Color.LightCoral;if (labell.Text = 1 & label2.Text = 2 & l

13、abel3.Text = 3 & label4.Text = 4 & label5.Text = 5 & label6.Text = 6 & label7.Text = 7 & label8.Text = 8 & label9.Text = 9)MessageBox.Show( A_A You did a great job A_A);this.Close();private void label5_Click(object sender, EventArgs e) .if (label2.BackColor = Color.LightCoral)string t = label2.Text;

14、label2.Text = label5.Text;label5.Text = t;label2.BackColor = Color.LightGreen;label5.BackColor = Color.LightCoral;if (label4.BackColor = Color.LightCoral)string t = label4.Text;label4.Text = label5.Text;label5.Text = t;label4.BackColor = Color.LightGreen;label5.BackColor = Color.LightCoral;if (label6.BackColor = Color.LightCoral)string t = label6.Text;label6.Text = label5.Text;label5.Text = t;label6.BackC010r = Color.LightGreen;label5.BackC010r = Color.Lig

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号