Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
пример3_ ПЗ_курсовой ЧМИ.doc
Скачиваний:
3
Добавлен:
28.08.2019
Размер:
2.32 Mб
Скачать

6 Разработка прикладного программного обеспечения

Класс WinForm

Свойства:

timer1: Timer- таймер;

timer2: Timer- таймер;

mainmenu1: Mainmenu- заглавное меню mainMenu1;

MenuItem1: MenuItem- элемент меню menuItem1 Новая игра.

Методы:

cell()- рисует клетку поля;

drawField()- отрисовывает поле;

newGame()- новая игра;

WinForm_Paint()- обработка события Paint;

WinForm_Load()- загрузка формы;

WinForm_MouseDown()- щелчок мыши на игровом поле;

timer1_Tick()- обработка события таймера;

menuItem1_Click()- щелчок на пункте меню Новая игра.

Класс Form1

Методы:

button1_Click()- щелчок мыши кнопки 1

Form1_Load()- загрузка формы Form1

pictureBox4_Paint()- заливка pictureBox4

pictureBox4_Click()- щелчок мыши на pictureBox4

pictureBox3_Click()- щелчок мыши на pictureBox3

pictureBox2_MouseDown()- нажатие кнопки мыши на pictureBox2

pictureBox2_Mouse Move ()-перемещение кнопки мыши на pictureBox2

pictureBox1_Click()- щелчок мыши на pictureBox1

UML диаграммы классов WinForm и Form1 представлены на диаграмме 6.1.

МИНИСТЕРСТВО ОБРАЗОВАНИЯ И НАУКИ УКРАИНЫ

ДОНЕЦКИЙ НАЦИОНАЛЬНЫЙ ТЕХНИЧЕСКИЙ УНИВЕРСИТЕТ

ПРИЛОЖЕНИЕ Б

Тексты (листинги) разработанного программного обеспечения

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsApplication1

{

public partial class Form1 : Form

{

Point spin = new Point();

public Form1()

{

InitializeComponent();

}

TextureBrush f1 = new TextureBrush(Image.FromFile(@"F2(1).jpg"));

TextureBrush f2 = new TextureBrush(Image.FromFile(@"F2(2).jpg"));

TextureBrush f3 = new TextureBrush(Image.FromFile(@"F2(3).jpg"));

TextureBrush f4 = new TextureBrush(Image.FromFile(@"F2(4).jpg"));

TextureBrush f5 = new TextureBrush(Image.FromFile(@"F2(5).jpg"));

TextureBrush f6 = new TextureBrush(Image.FromFile(@"F2(6).jpg"));

System.Media.SoundPlayer sp1;

System.Media.SoundPlayer sp;

static public int statuf1 = 1;

private void panel1_Paint(object sender, PaintEventArgs e)

{

if (statuf1 == 1) e.Graphics.FillRectangle(f1, new Rectangle(0, 0, panel1.Width, panel1.Height));

if (statuf1 == 2) e.Graphics.FillRectangle(f2, new Rectangle(0, 0, panel1.Width, panel1.Height));

if (statuf1 == 3) e.Graphics.FillRectangle(f3, new Rectangle(0, 0, panel1.Width, panel1.Height));

if (statuf1 == 4) e.Graphics.FillRectangle(f4, new Rectangle(0, 0, panel1.Width, panel1.Height));

if (statuf1 == 5) e.Graphics.FillRectangle(f5, new Rectangle(0, 0, panel1.Width, panel1.Height));

if (statuf1 == 6) e.Graphics.FillRectangle(f6, new Rectangle(0, 0, panel1.Width, panel1.Height));

}

TextureBrush f11 = new TextureBrush(Image.FromFile(@"F3(1).jpg"));

TextureBrush f12 = new TextureBrush(Image.FromFile(@"F3(2).jpg"));

TextureBrush f13 = new TextureBrush(Image.FromFile(@"F3(3).jpg"));

TextureBrush f14 = new TextureBrush(Image.FromFile(@"F3(4).jpg"));

TextureBrush f15 = new TextureBrush(Image.FromFile(@"F3(5).jpg"));

TextureBrush f16 = new TextureBrush(Image.FromFile(@"F3(6).jpg"));

static int statusf2 = 1;

private void panel2_Paint(object sender, PaintEventArgs e)

{

if (statusf2 == 1) e.Graphics.FillRectangle(f11, new Rectangle(0, 0, panel2.Width, panel2.Height));

if (statusf2 == 2) e.Graphics.FillRectangle(f12, new Rectangle(0, 0, panel2.Width, panel2.Height));

if (statusf2 == 3) e.Graphics.FillRectangle(f13, new Rectangle(0, 0, panel2.Width, panel2.Height));

if (statusf2 == 4) e.Graphics.FillRectangle(f14, new Rectangle(0, 0, panel2.Width, panel2.Height));

if (statusf2 == 5) e.Graphics.FillRectangle(f15, new Rectangle(0, 0, panel2.Width, panel2.Height));

if (statusf2 == 6) e.Graphics.FillRectangle(f16, new Rectangle(0, 0, panel2.Width, panel2.Height));

}

private void pictureBox1_Click(object sender, EventArgs e)

{

}

private void pictureBox1_DragDrop(object sender, DragEventArgs e)

{

}

private void pictureBox1_MouseDown(object sender, MouseEventArgs e)

{

spin.X = e.X;

spin.Y = e.Y;

}

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

Point mp = new Point();

mp.X = e.X;

mp.Y = e.Y;

Point np = new Point();

np.X = this.Location.X + mp.X - spin.X;

np.Y = this.Location.Y + mp.Y - spin.Y;

this.Location = np;

}

}

TextureBrush b0 = new TextureBrush(Image.FromFile(@"c1.jpg"));

TextureBrush b1 = new TextureBrush(Image.FromFile(@"c2.jpg"));

TextureBrush b2 = new TextureBrush(Image.FromFile(@"c3.jpg"));

static int status = 1;

private void pictureBox2_Paint(object sender, PaintEventArgs e)

{

if (status == 1) e.Graphics.FillRectangle(b0, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

if (status == 2) e.Graphics.FillRectangle(b1, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

if (status == 3) e.Graphics.FillRectangle(b2, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

}

private void pictureBox2_MouseLeave(object sender, EventArgs e)

{

status = 1;

this.pictureBox2.Invalidate();

}

private void pictureBox2_MouseDown(object sender, MouseEventArgs e)

{

status = 3;

this.pictureBox2.Invalidate();

}

private void pictureBox2_MouseUp(object sender, MouseEventArgs e)

{

status = 2;

this.pictureBox2.Invalidate();

}

private void pictureBox2_MouseHover(object sender, EventArgs e)

{

status = 2;

this.pictureBox2.Invalidate();

}

private void pictureBox2_Click(object sender, EventArgs e)

{

panel3.Visible = true;

}

TextureBrush s0 = new TextureBrush(Image.FromFile(@"s1.jpg"));

TextureBrush s1 = new TextureBrush(Image.FromFile(@"s2.jpg"));

TextureBrush s2 = new TextureBrush(Image.FromFile(@"s3.jpg"));

static int statuss = 1;

private void pictureBox3_Paint(object sender, PaintEventArgs e)

{

if (statuss == 1) e.Graphics.FillRectangle(s0, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

if (statuss == 2) e.Graphics.FillRectangle(s1, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

if (statuss == 3) e.Graphics.FillRectangle(s2, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height));

}

private void pictureBox3_MouseLeave(object sender, EventArgs e)

{

statuss = 1;

this.pictureBox3.Invalidate();

}

private void pictureBox3_MouseDown(object sender, MouseEventArgs e)

{

statuss = 3;

this.pictureBox3.Invalidate();

}

private void pictureBox3_MouseUp(object sender, MouseEventArgs e)

{

statuss = 2;

this.pictureBox3.Invalidate();

}

private void pictureBox3_MouseHover(object sender, EventArgs e)

{

statuss = 2;

this.pictureBox3.Invalidate();

}

private void pictureBox3_Click(object sender, EventArgs e)

{

this.WindowState = FormWindowState.Minimized;

}

TextureBrush p10 = new TextureBrush(Image.FromFile(@"button/p1/1.jpg"));

TextureBrush p11 = new TextureBrush(Image.FromFile(@"button/p1/2.jpg"));

TextureBrush p12 = new TextureBrush(Image.FromFile(@"button/p1/3.jpg"));

TextureBrush p13 = new TextureBrush(Image.FromFile(@"button/p1/4.jpg"));

static int statusp = 1;

private void p1_Paint(object sender, PaintEventArgs e)

{

if (statusp == 1) e.Graphics.FillRectangle(p10, new Rectangle(0, 0, p1.Width, p1.Height));

if (statusp == 2) e.Graphics.FillRectangle(p11, new Rectangle(0, 0, p1.Width, p1.Height));

if (statusp == 3) e.Graphics.FillRectangle(p12, new Rectangle(0, 0, p1.Width, p1.Height));

if (statusp == 4) e.Graphics.FillRectangle(p13, new Rectangle(0, 0, p1.Width, p1.Height));

}

private void p1_MouseLeave(object sender, EventArgs e)

{

statusp = 1;

this.p1.Invalidate();

}

private void p1_MouseHover(object sender, EventArgs e)

{

}

private void p1_MouseDown(object sender, MouseEventArgs e)

{

statusp = 2;

this.p1.Invalidate();

}

private void p1_MouseUp(object sender, MouseEventArgs e)

{

statusp = 1;

this.p1.Invalidate();

}

private void p1_MouseEnter(object sender, EventArgs e)

{

statusp = 3;

this.p1.Invalidate();

}

TextureBrush p20 = new TextureBrush(Image.FromFile(@"button/p2/1.jpg"));

TextureBrush p21 = new TextureBrush(Image.FromFile(@"button/p2/2.jpg"));

TextureBrush p22 = new TextureBrush(Image.FromFile(@"button/p2/3.jpg"));

TextureBrush p23 = new TextureBrush(Image.FromFile(@"button/p2/4.jpg"));

static int statusp2 = 1;

string FName;

string FName1;

private void p2_Paint(object sender, PaintEventArgs e)

{

if (statusp2 == 1) e.Graphics.FillRectangle(p20, new Rectangle(0, 0, p2.Width, p2.Height));

if (statusp2 == 2) e.Graphics.FillRectangle(p21, new Rectangle(0, 0, p2.Width, p2.Height));

if (statusp2 == 3) e.Graphics.FillRectangle(p22, new Rectangle(0, 0, p2.Width, p2.Height));

if (statusp2 == 4) e.Graphics.FillRectangle(p23, new Rectangle(0, 0, p2.Width, p2.Height));

}

private void p2_MouseLeave(object sender, EventArgs e)

{

statusp2 = 1;

this.p2.Invalidate();

}

private void p2_MouseHover(object sender, EventArgs e)

{

}

private void p2_MouseDown(object sender, MouseEventArgs e)

{

statusp2 = 2;

this.p2.Invalidate();

}

private void p2_MouseUp(object sender, MouseEventArgs e)

{

statusp2 = 1;

this.p2.Invalidate();

}

private void p2_MouseEnter(object sender, EventArgs e)

{

statusp2 = 3;

this.p2.Invalidate();

}

TextureBrush o10 = new TextureBrush(Image.FromFile(@"button/o1/1.jpg"));

TextureBrush o11 = new TextureBrush(Image.FromFile(@"button/o1/2.jpg"));

TextureBrush o12 = new TextureBrush(Image.FromFile(@"button/o1/3.jpg"));

TextureBrush o13 = new TextureBrush(Image.FromFile(@"button/o1/4.jpg"));

static int statuso1 = 1;

private void o1_Paint(object sender, PaintEventArgs e)

{

if (statuso1 == 1) e.Graphics.FillRectangle(o10, new Rectangle(0, 0, o1.Width, o1.Height));

if (statuso1 == 2) e.Graphics.FillRectangle(o11, new Rectangle(0, 0, o1.Width, o1.Height));

if (statuso1 == 3) e.Graphics.FillRectangle(o12, new Rectangle(0, 0, o1.Width, o1.Height));

if (statuso1 == 4) e.Graphics.FillRectangle(o13, new Rectangle(0, 0, o1.Width, o1.Height));

}

private void o1_MouseLeave(object sender, EventArgs e)

{

statuso1 = 1;

this.o1.Invalidate();

}

private void o1_MouseHover(object sender, EventArgs e)

{

}

private void o1_MouseDown(object sender, MouseEventArgs e)

{

statuso1 = 2;

this.o1.Invalidate();

}

private void o1_MouseUp(object sender, MouseEventArgs e)

{

statuso1 = 1;

this.o1.Invalidate();

}

private void o1_MouseEnter(object sender, EventArgs e)

{

statuso1 = 3;

this.o1.Invalidate();

}

private void o1_Click(object sender, EventArgs e)

{

type = 1;

openFileDialog1.Filter = "музыкальные файлы (*.wav)|*.wav";

openFileDialog1.ShowDialog();

FName = openFileDialog1.FileName;

}

static int type = 0;

private void openFileDialog1_FileOk(object sender, CancelEventArgs e)

{

FName = openFileDialog1.FileName;

this.label1.Text = FName;

if (type == 1)

{

sp = new System.Media.SoundPlayer(FName);

}

}

private void openFileDialog2_FileOk(object sender, CancelEventArgs e)

{

FName1 = openFileDialog2.FileName;

this.label2.Text = FName1;

if(type==2)

{

sp1 = new System.Media.SoundPlayer(FName1);

}

}

TextureBrush o20 = new TextureBrush(Image.FromFile(@"button/o2/1.jpg"));

TextureBrush o21 = new TextureBrush(Image.FromFile(@"button/o2/2.jpg"));

TextureBrush o22 = new TextureBrush(Image.FromFile(@"button/o2/3.jpg"));

TextureBrush o23 = new TextureBrush(Image.FromFile(@"button/o2/4.jpg"));

static int statuso2 = 1;

private void o2_Paint(object sender, PaintEventArgs e)

{

if (statuso2 == 1) e.Graphics.FillRectangle(o20, new Rectangle(0, 0, o2.Width, o2.Height));

if (statuso2 == 2) e.Graphics.FillRectangle(o21, new Rectangle(0, 0, o2.Width, o2.Height));

if (statuso2 == 3) e.Graphics.FillRectangle(o22, new Rectangle(0, 0, o2.Width, o2.Height));

if (statuso2 == 4) e.Graphics.FillRectangle(o23, new Rectangle(0, 0, o2.Width, o2.Height));

}

private void o2_MouseLeave(object sender, EventArgs e)

{

statuso2 = 1;

this.o2.Invalidate();

}

private void o2_MouseHover(object sender, EventArgs e)

{

}

private void o2_MouseDown(object sender, MouseEventArgs e)

{

statuso2 = 2;

this.o2.Invalidate();

}

private void o2_MouseUp(object sender, MouseEventArgs e)

{

statuso2 = 1;

this.o2.Invalidate();

}

private void o2_MouseEnter(object sender, EventArgs e)

{

statuso2 = 3;

this.o2.Invalidate();

}

private void o2_Click(object sender, EventArgs e)

{

type = 2;

openFileDialog2.Filter = "музыкальные файлы (*.wav)|*.wav";

openFileDialog2.ShowDialog();

}

TextureBrush s20 = new TextureBrush(Image.FromFile(@"button/s2/1.jpg"));

TextureBrush s21 = new TextureBrush(Image.FromFile(@"button/s2/2.jpg"));

TextureBrush s22 = new TextureBrush(Image.FromFile(@"button/s2/3.jpg"));

TextureBrush s23 = new TextureBrush(Image.FromFile(@"button/s2/4.jpg"));

static int statuss2 = 1;

private void pictureBox9_Paint(object sender, PaintEventArgs e)

{

if (statuss2 == 1) e.Graphics.FillRectangle(s20, new Rectangle(0, 0, pictureBox9.Width, pictureBox9.Height));

if (statuss2 == 2) e.Graphics.FillRectangle(s21, new Rectangle(0, 0, pictureBox9.Width, pictureBox9.Height));

if (statuss2 == 3) e.Graphics.FillRectangle(s22, new Rectangle(0, 0, pictureBox9.Width, pictureBox9.Height));

if (statuss2 == 4) e.Graphics.FillRectangle(s23, new Rectangle(0, 0, pictureBox9.Width, pictureBox9.Height));

}

private void pictureBox9_MouseLeave(object sender, EventArgs e)

{

statuss2 = 1;

this.pictureBox9.Invalidate();

}

private void pictureBox9_MouseHover(object sender, EventArgs e)

{

}

private void pictureBox9_MouseDown(object sender, MouseEventArgs e)

{

statuss2 = 2;

this.pictureBox9.Invalidate();

}

private void pictureBox9_MouseUp(object sender, MouseEventArgs e)

{

statuss2 = 1;

this.pictureBox9.Invalidate();

}

private void pictureBox9_MouseEnter(object sender, EventArgs e)

{

statuss2 = 3;

this.pictureBox9.Invalidate();

}

TextureBrush s10 = new TextureBrush(Image.FromFile(@"button/s1/1.jpg"));

TextureBrush s11 = new TextureBrush(Image.FromFile(@"button/s1/2.jpg"));

TextureBrush s12 = new TextureBrush(Image.FromFile(@"button/s1/3.jpg"));

TextureBrush s13 = new TextureBrush(Image.FromFile(@"button/s1/4.jpg"));

static int statuss1 = 1;

private void pictureBox5_Paint(object sender, PaintEventArgs e)

{

if (statuss1 == 1) e.Graphics.FillRectangle(s10, new Rectangle(0, 0, pictureBox5.Width, pictureBox5.Height));

if (statuss1 == 2) e.Graphics.FillRectangle(s11, new Rectangle(0, 0, pictureBox5.Width, pictureBox5.Height));

if (statuss1 == 3) e.Graphics.FillRectangle(s12, new Rectangle(0, 0, pictureBox5.Width, pictureBox5.Height));

if (statuss1 == 4) e.Graphics.FillRectangle(s13, new Rectangle(0, 0, pictureBox5.Width, pictureBox5.Height));

}

private void pictureBox5_MouseLeave(object sender, EventArgs e)

{

statuss1 = 1;

this.pictureBox5.Invalidate();

}

private void pictureBox5_MouseHover(object sender, EventArgs e)

{

}

private void pictureBox5_MouseDown(object sender, MouseEventArgs e)

{

statuss1 = 2;

this.pictureBox5.Invalidate();

}

private void pictureBox5_MouseUp(object sender, MouseEventArgs e)

{

statuss1 = 1;

this.pictureBox5.Invalidate();

}

private void pictureBox5_MouseEnter(object sender, EventArgs e)

{

statuss1 = 3;

this.pictureBox5.Invalidate();

}

TextureBrush pa10 = new TextureBrush(Image.FromFile(@"button/pa1/1.jpg"));

TextureBrush pa11 = new TextureBrush(Image.FromFile(@"button/pa1/2.jpg"));

TextureBrush pa12 = new TextureBrush(Image.FromFile(@"button/pa1/3.jpg"));

TextureBrush pa13 = new TextureBrush(Image.FromFile(@"button/pa1/4.jpg"));

static int statuspa1 = 1;

private void pictureBox4_Paint(object sender, PaintEventArgs e)

{

if (statuspa1 == 1) e.Graphics.FillRectangle(pa10, new Rectangle(0, 0, pictureBox4.Width, pictureBox4.Height));

if (statuspa1 == 2) e.Graphics.FillRectangle(pa11, new Rectangle(0, 0, pictureBox4.Width, pictureBox4.Height));

if (statuspa1 == 3) e.Graphics.FillRectangle(pa12, new Rectangle(0, 0, pictureBox4.Width, pictureBox4.Height));

if (statuspa1 == 4) e.Graphics.FillRectangle(pa13, new Rectangle(0, 0, pictureBox4.Width, pictureBox4.Height));

}

private void pictureBox4_MouseLeave(object sender, EventArgs e)

{

statuspa1 = 1;

this.pictureBox4.Invalidate();

}

private void pictureBox4_MouseHover(object sender, EventArgs e)

{

}

private void pictureBox4_MouseDown(object sender, MouseEventArgs e)

{

statuspa1 = 2;

this.pictureBox4.Invalidate();

}

private void pictureBox4_MouseUp(object sender, MouseEventArgs e)

{

statuspa1 = 1;

this.pictureBox5.Invalidate();

}

private void pictureBox4_MouseEnter(object sender, EventArgs e)

{

statuspa1 = 3;

this.pictureBox4.Invalidate();

}

TextureBrush pa20 = new TextureBrush(Image.FromFile(@"button/pa2/1.jpg"));

TextureBrush pa21 = new TextureBrush(Image.FromFile(@"button/pa2/2.jpg"));

TextureBrush pa22 = new TextureBrush(Image.FromFile(@"button/pa2/3.jpg"));

TextureBrush pa23 = new TextureBrush(Image.FromFile(@"button/pa2/4.jpg"));

static int statuspa2 = 1;

private void pictureBox8_Paint(object sender, PaintEventArgs e)

{

if (statuspa2 == 1) e.Graphics.FillRectangle(pa20, new Rectangle(0, 0, pictureBox8.Width, pictureBox8.Height));

if (statuspa2 == 2) e.Graphics.FillRectangle(pa21, new Rectangle(0, 0, pictureBox8.Width, pictureBox8.Height));

if (statuspa2 == 3) e.Graphics.FillRectangle(pa22, new Rectangle(0, 0, pictureBox8.Width, pictureBox8.Height));

if (statuspa2 == 4) e.Graphics.FillRectangle(pa23, new Rectangle(0, 0, pictureBox8.Width, pictureBox8.Height));

}

private void pictureBox8_MouseLeave(object sender, EventArgs e)

{

statuspa2 = 1;

this.pictureBox8.Invalidate();

}

private void pictureBox8_MouseHover(object sender, EventArgs e)

{

}

private void pictureBox8_MouseDown(object sender, MouseEventArgs e)

{

statuspa2 = 2;

this.pictureBox8.Invalidate();

}

private void pictureBox8_MouseUp(object sender, MouseEventArgs e)

{

statuspa2 = 1;

this.pictureBox8.Invalidate();

}

private void pictureBox8_MouseEnter(object sender, EventArgs e)

{

statuspa2 = 3;

this.pictureBox8.Invalidate();

}

private void timer1_Tick(object sender, EventArgs e)

{

if (statuf1 == 1)

statuf1 = 2;

else

if (statuf1 == 2)

statuf1 = 3;

else

if (statuf1 == 3)

statuf1 = 4;

else

if (statuf1 == 4)

statuf1 = 5;

else

if (statuf1 == 5)

statuf1 = 6;

else

if (statuf1 == 6)

statuf1 = 1;

this.panel1.Invalidate();

}

private void Form1_KeyPress(object sender, KeyPressEventArgs e)

{

if (e.KeyChar == 'D' || e.KeyChar == 'd' || e.KeyChar == 'В' || e.KeyChar == 'в')

this.o1_Click(sender,e);

if (e.KeyChar == 'W' || e.KeyChar == 'w' || e.KeyChar == 'Ц' || e.KeyChar == 'ц')

this.p1_Click(sender, e);

if (e.KeyChar == 'S' || e.KeyChar == 's' || e.KeyChar == 'Ы' || e.KeyChar == 'ы')

this.pictureBox5_Click(sender, e);

if (e.KeyChar == 'A' || e.KeyChar == 'a' || e.KeyChar == 'Ф' || e.KeyChar == 'ф')

this.pictureBox4_Click(sender, e);

}

private void p2_Click(object sender, EventArgs e)

{

sp1.Play();

timer2.Enabled = true;

}

private void p1_Click(object sender, EventArgs e)

{

sp.Play();

timer1.Enabled = true;

}

private void pictureBox5_Click(object sender, EventArgs e)

{

sp.Stop();

timer1.Enabled = false;

}

private void pictureBox9_Click(object sender, EventArgs e)

{

sp1.Stop();

timer2.Enabled = false;

}

private void pictureBox4_Click(object sender, EventArgs e)

{

sp.Pause();

}

private void timer2_Tick(object sender, EventArgs e)

{

if (statusf2 == 1)

statusf2 = 2;

else

if (statusf2 == 2)

statusf2 = 3;

else

if (statusf2 == 3)

statusf2 = 4;

else

if (statusf2 == 4)

statusf2 = 5;

else

if (statusf2 == 5)

statusf2 = 6;

else

if (statusf2 == 6)

statusf2 = 1;

this.panel2.Invalidate();

}

TextureBrush y0 = new TextureBrush(Image.FromFile(@"button/y/1.jpg"));

TextureBrush y1 = new TextureBrush(Image.FromFile(@"button/y/2.jpg"));

TextureBrush y2 = new TextureBrush(Image.FromFile(@"button/y/3.jpg"));

TextureBrush y3 = new TextureBrush(Image.FromFile(@"button/y/4.jpg"));

static int statusy = 1;

private void y_Paint(object sender, PaintEventArgs e)

{

if (statusy == 1) e.Graphics.FillRectangle(y0, new Rectangle(0, 0, y.Width, y.Height));

if (statusy == 2) e.Graphics.FillRectangle(y1, new Rectangle(0, 0, y.Width, y.Height));

if (statusy == 3) e.Graphics.FillRectangle(y2, new Rectangle(0, 0, y.Width, y.Height));

if (statusy == 4) e.Graphics.FillRectangle(y3, new Rectangle(0, 0, y.Width, y.Height));

}

private void y_MouseLeave(object sender, EventArgs e)

{

statusy = 1;

this.y.Invalidate();

}

private void y_MouseHover(object sender, EventArgs e)

{

}

private void y_MouseDown(object sender, MouseEventArgs e)

{

statusy = 2;

this.y.Invalidate();

}

private void y_MouseUp(object sender, MouseEventArgs e)

{

statusy = 1;

this.y.Invalidate();

}

private void y_MouseEnter(object sender, EventArgs e)

{

statusy = 3;

this.y.Invalidate();

}

private void y_Click(object sender, EventArgs e)

{

Application.Exit();

}

TextureBrush n0 = new TextureBrush(Image.FromFile(@"button/n/1.jpg"));

TextureBrush n1 = new TextureBrush(Image.FromFile(@"button/n/2.jpg"));

TextureBrush n2 = new TextureBrush(Image.FromFile(@"button/n/3.jpg"));

TextureBrush n3 = new TextureBrush(Image.FromFile(@"button/n/4.jpg"));

static int statusn = 1;

private void n_Paint(object sender, PaintEventArgs e)

{

if (statusn == 1) e.Graphics.FillRectangle(n0, new Rectangle(0, 0, n.Width, n.Height));

if (statusn == 2) e.Graphics.FillRectangle(n1, new Rectangle(0, 0, n.Width, n.Height));

if (statusn == 3) e.Graphics.FillRectangle(n2, new Rectangle(0, 0, n.Width, n.Height));

if (statusn == 4) e.Graphics.FillRectangle(n3, new Rectangle(0, 0, n.Width, n.Height));

}

private void n_MouseLeave(object sender, EventArgs e)

{

statusn = 1;

this.n.Invalidate();

}

private void n_MouseHover(object sender, EventArgs e)

{

}

private void n_MouseDown(object sender, MouseEventArgs e)

{

statusy = 2;

this.n.Invalidate();

}

private void n_MouseUp(object sender, MouseEventArgs e)

{

statusn = 1;

this.n.Invalidate();

}

private void n_MouseEnter(object sender, EventArgs e)

{

statusn = 3;

this.n.Invalidate();

}

private void n_Click(object sender, EventArgs e)

{

panel3.Visible = false;

}

private void pictureBox8_Click(object sender, EventArgs e)

{

sp1.Pause();

}

}

}