using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Random random = new Random();
private void DrawPaper()
{
Graphics paper = groupBox1.CreateGraphics();
SolidBrush brush = new SolidBrush(Color.White);
paper.FillRectangle(brush, 30, 30, 210, 170);
}
private void DrawScissors()
{
Graphics paper = groupBox1.CreateGraphics();
Pen pen = new Pen(Color.Black, 4);
paper.DrawLine(pen, 30, 30, 240, 200);
paper.DrawLine(pen, 240, 30, 30, 200);
}
private void DrawRock()
{
Graphics paper = groupBox1.CreateGraphics();
SolidBrush brush = new SolidBrush(Color.Red);
paper.FillEllipse(brush, 30, 30, 210, 170);
}
private void DrawPaper2()
{
Graphics paper2 = groupBox2.CreateGraphics();
SolidBrush brush2 = new SolidBrush(Color.White);
paper2.FillRectangle(brush2, 30, 30, 210, 170);
}
private void DrawScissors2()
{
Graphics paper2 = groupBox2.CreateGraphics();
Pen pen2 = new Pen(Color.Black, 4);
paper2.DrawLine(pen2, 30, 30, 240, 200);
paper2.DrawLine(pen2, 240, 30, 30, 200);
}
private void DrawRock2()
{
Graphics paper2 = groupBox2.CreateGraphics();
SolidBrush brush2 = new SolidBrush(Color.Red);
paper2.FillEllipse(brush2, 30, 30, 210, 170);
}
private void buttonPaper_Click(object sender, EventArgs e)
{
this.Refresh();
DrawPaper();
int num = random.Next(3);
{
if (num == 0)
{
DrawRock2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawScissors2();
label1.Text = "You lose!";
}
else
{
DrawPaper2();
label1.Text = "Draw";
}
}
}
private void buttonScissors_Click(object sender, EventArgs e)
{
this.Refresh();
DrawScissors();
int num = random.Next(3);
{
if (num == 0)
{
DrawPaper2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawRock2();
label1.Text = "You lose!";
}
else
{
DrawScissors2();
label1.Text = "Draw";
}
}
}
private void buttonRock_Click(object sender, EventArgs e)
{
this.Refresh();
DrawRock();
int num = random.Next(3);
{
if (num == 0)
{
DrawScissors2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawPaper2();
label1.Text = "You lose!";
}
else
{
DrawRock2();
label1.Text = "Draw";
}
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Random random = new Random();
private void DrawPaper()
{
Graphics paper = groupBox1.CreateGraphics();
SolidBrush brush = new SolidBrush(Color.White);
paper.FillRectangle(brush, 30, 30, 210, 170);
}
private void DrawScissors()
{
Graphics paper = groupBox1.CreateGraphics();
Pen pen = new Pen(Color.Black, 4);
paper.DrawLine(pen, 30, 30, 240, 200);
paper.DrawLine(pen, 240, 30, 30, 200);
}
private void DrawRock()
{
Graphics paper = groupBox1.CreateGraphics();
SolidBrush brush = new SolidBrush(Color.Red);
paper.FillEllipse(brush, 30, 30, 210, 170);
}
private void DrawPaper2()
{
Graphics paper2 = groupBox2.CreateGraphics();
SolidBrush brush2 = new SolidBrush(Color.White);
paper2.FillRectangle(brush2, 30, 30, 210, 170);
}
private void DrawScissors2()
{
Graphics paper2 = groupBox2.CreateGraphics();
Pen pen2 = new Pen(Color.Black, 4);
paper2.DrawLine(pen2, 30, 30, 240, 200);
paper2.DrawLine(pen2, 240, 30, 30, 200);
}
private void DrawRock2()
{
Graphics paper2 = groupBox2.CreateGraphics();
SolidBrush brush2 = new SolidBrush(Color.Red);
paper2.FillEllipse(brush2, 30, 30, 210, 170);
}
private void buttonPaper_Click(object sender, EventArgs e)
{
this.Refresh();
DrawPaper();
int num = random.Next(3);
{
if (num == 0)
{
DrawRock2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawScissors2();
label1.Text = "You lose!";
}
else
{
DrawPaper2();
label1.Text = "Draw";
}
}
}
private void buttonScissors_Click(object sender, EventArgs e)
{
this.Refresh();
DrawScissors();
int num = random.Next(3);
{
if (num == 0)
{
DrawPaper2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawRock2();
label1.Text = "You lose!";
}
else
{
DrawScissors2();
label1.Text = "Draw";
}
}
}
private void buttonRock_Click(object sender, EventArgs e)
{
this.Refresh();
DrawRock();
int num = random.Next(3);
{
if (num == 0)
{
DrawScissors2();
label1.Text = "You win!";
}
else if (num == 1)
{
DrawPaper2();
label1.Text = "You lose!";
}
else
{
DrawRock2();
label1.Text = "Draw";
}
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}