排球计分
开发流程:
计划:一周
开发:
需求分析:作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况
设计复审:同学审核
具体设计:合理的布局
<body>
<form id="AddInfo" action="AddInfoHandler.ashx" method="post">
<table>
<tr>
<td>球衣号:</td>
<td>
<input type="text" id="id" />
</td>
</tr>
<tr>
<td>姓名:</td>
<td>
<input type="text" name="name" />
</td>
</tr>
<tr>
<td>队伍名:</td>
<td>
<input type="text" teamname="teamname" />
</td>
</tr>
<tr>
<td>定位:</td>
<td>
<input type="text" status="status" />
</td>
</tr>
<tr>
<td>得分队员:</td>
<td>
<input type="text" scoreplayer1="scoreplayer1" />
</td>
</tr>
<tr>
<td>得分:</td>
<td>
<input type="text" totalscore1="totalscore1" />
</td>
</tr>
<tr>
<td>得分队员:</td>
<td>
<input type="text" scoreplayer2="scoreplayer2" />
</td>
</tr>
<tr>
<td>得分队员:</td>
<td>
<input type="text" totalscore2="totalscore2" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="添加" />
</td>
</tr>
</table>
</form>
namespace 排球计分
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text = "0";
textBox2.Text = "0";
button2.Enabled = false;
button4.Enabled = false;
label6.Text = "0";
label10.Text = "0";
}
private void button5_Click(object sender, EventArgs e) //查看结果
{
Form2 frm2 = new Form2(textBox1.Text, textBox2.Text,label10.Text);
if (int.Parse(textBox1.Text) > int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
{
MessageBox.Show("A队胜");
frm2.Show();
this.Hide();
}
else if (int.Parse(textBox1.Text) < int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
{
MessageBox.Show("B队胜");
frm2.Show();
this.Hide();
}
else if (int.Parse(textBox2.Text) == int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
{
MessageBox.Show("平局");
frm2.Show();
this.Hide(); ;
}
else
{
MessageBox.Show("请检查计分是否出现错误");
}
}
private void button1_Click(object sender, EventArgs e) //A队加分
{
if (int.Parse(label6.Text) < 11)
{
textBox1.Text = (int.Parse(textBox1.Text) + 1).ToString();
label6.Text = (int.Parse(label6.Text) + 1).ToString();
button2.Enabled = true;
}
else
{
MessageBox.Show("超出得分上限,本场比赛已经进行11局");
}
}
private void button2_Click(object sender, EventArgs e) //A队减分
{
if (int.Parse(textBox1.Text) - 1 >= 0)
{
textBox1.Text = (int.Parse(textBox1.Text) - 1).ToString();
label6.Text = (int.Parse(label6.Text) - 1).ToString();
}
else
{
MessageBox.Show("A队得分为0分,不可进行减分操作");
button2.Enabled = false;
}
}
private void button3_Click(object sender, EventArgs e) //B队加分
{
if (int.Parse(label6.Text) < 11)
{
textBox2.Text = (int.Parse(textBox2.Text) + 1).ToString();
label6.Text = (int.Parse(label6.Text) + 1).ToString();
button4.Enabled = true;
}
else
{
MessageBox.Show("超出得分上限,本场比赛已经进行11局");
}
}
private void button4_Click(object sender, EventArgs e) //B队减分
{
if (int.Parse(textBox2.Text) - 1 >= 0)
{
textBox2.Text = (int.Parse(textBox2.Text) - 1).ToString();
label6.Text = (int.Parse(label6.Text) - 1).ToString();
}
else
{
MessageBox.Show("B队得分为0分,不可进行减分操作");
button4.Enabled = false;
}
}
private void button8_Click(object sender, EventArgs e) //平局
{
if (int.Parse(label6.Text) < 11)
{
label6.Text = (int.Parse(label6.Text) + 1).ToString();
label10.Text = (int.Parse(label10.Text) + 1).ToString();
}
else
{
MessageBox.Show("本场比赛已经进行11局");
}
}
private void button10_Click(object sender, EventArgs e) //规则说明
{
MessageBox.Show("规则为:\n 1.本次比赛共三场,每场比赛有十一局\n 2.胜者得一分,平局双方都不加分,均记作一局\n 3.点击查看结果可进入下一场比赛,并看到本场比分\n 4.请遵循比赛规则,操作错误我们会给予提示");
}
private void button9_Click(object sender, EventArgs e) //退出软件
{
this.Close();
}
private void button7_Click(object sender, EventArgs e)
{
MessageBox.Show("比赛未进行完,无法查看结果");
}
}
}