如何制作羽毛球计分系统 [英] How to make badminton scoring system

查看:109
本文介绍了如何制作羽毛球计分系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我是新来的,我也是视觉工作室编程的新手,所以问题是我正在为羽毛球场的裁判建立羽毛球得分应用程序。当你的最高点数达到30时我的得分系统有问题,但是在羽毛球30中如果只有他们的
有平衡,获胜分数是21并且当你赢得2套时有3套游戏然后你赢了游戏。如果最高分数为30且21是获胜点,我如何限制分数并将分数转移到下一个文本框?这是我的代码

 private void point1_Click(object sender,EventArgs e)
{
if(score_home.Tag is int)
{
int a =(int)score_home.Tag;
a ++;
得分_home.Tag = a;
score_home.Text = a.ToString();
if(a == 21)
score_home.Tag = 21;
else if(a< 0)
score_home.Tag = 0;
if(a == 21)
score_home_2.Text = score_home.Text;
if(a == 21)
score_away_2.Text = score_away.Text;
if(a == 22)
score_home.Tag = 0;
if(a == 22)
score_home.Text =" 0" ;;
if(a == 22)
score_away.Tag = 0;
if(a == 22)
score_away.Text =" 0" ;;



}

else
{
score_home.Tag = 1;
score_home.Text =" 1" ;;
}


}

解决方案

您好Fadel Zuhair,


感谢您在此发帖。


如果要将数据发送到两个表单之间的其他控件,可以使用委托。

 namespace sent_value 
{
public delegate void _del(string str);

公共部分类Form2:表格
{
public _del del;
public Form2(_del d)
{
this.del = d;
InitializeComponent();

}

private void button1_Click(object sender,EventArgs e)
{
del(richTextBox1.Text);

}
}
}




 public partial class Form1:Form 
{

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender,EventArgs e)
{
Form2 form2 = new Form2(showstring);
form2.Show();
}

private void showstring(string str)
{

label1.Text = str;

}
}




关于逻辑问题,您需要调试项目。


最好的问候,


Hart


编辑:


如果要在一个表单中设置文本值,可以使用以下方法。 

 int a = 156; 
textBox1.Text = a.ToString();



Hi guys, I'm new here and I'm also new with visual studio programing, so the question is I'm building badminton scoring app for refree in badminton field. I have a problem with scoring system when you have max point to 30, but in badminton 30 if only they have deuce, winning score is 21 and have 3 set game when you win 2 set then you win the game. If the max score is 30 and 21 is winning point, how do I limit the score and transfer the score to the next textbox? And Here's my code

 private void point1_Click(object sender, EventArgs e)
        {
            if (score_home.Tag is int)
            {
                int a = (int)score_home.Tag;
                a++;
                score_home.Tag = a;
                score_home.Text = a.ToString();
                if (a == 21)
                    score_home.Tag = 21;
                else if (a < 0)
                    score_home.Tag = 0;
                if (a == 21)
                    score_home_2.Text = score_home.Text;                
                if (a == 21)
                    score_away_2.Text = score_away.Text;
                if (a == 22)
                    score_home.Tag = 0;
                if (a == 22)
                    score_home.Text = "0";
                if (a == 22)
                    score_away.Tag = 0;
                if (a == 22)
                    score_away.Text = "0";
               
                
                   
            }
        
            else
            {
                score_home.Tag = 1;
                score_home.Text = "1";
            }


        }

解决方案

Hi Fadel Zuhair,

Thank you for posting here.

If you want to send data to other control between two forms, you can use a delegate.

namespace sent_value
{
    public delegate void _del(string str);

    public partial class Form2 : Form
    {
        public _del del;
        public Form2(_del d)
        {
            this.del = d;
            InitializeComponent();
         
        }

        private void button1_Click(object sender, EventArgs e)
        {
            del(richTextBox1.Text);
        
        }
    }
}


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

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2(showstring);
             form2.Show();
        }

        private void showstring(string str)
        {
            
        label1.Text = str;
          
        }
}


About logical issue, you need to debug your project.

Best Regards,

Hart

edit:

If you want to set text value inside one form, you can use following method. 

 int a = 156;
 textBox1.Text = a.ToString();


这篇关于如何制作羽毛球计分系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆