我正在尝试制作飞镖游戏,例如301。 [英] I am trying to make a dart game eg 301.

查看:91
本文介绍了我正在尝试制作飞镖游戏,例如301。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正试图让我的作品但是已经被卡住了。我需要帮助来了解如何呈现分数。我在控制台模式下制作了同样的程序。在那里我为每个玩家打印每一个回合



player1

转1 2 3 4 5 6

10 20 11 10 11 7等等

8 20 20 16 18 19

12 1 1 19 20 1







谢谢



Johan



我尝试了什么:



是否有一种很好的方式来呈现winform中的分数?我不认为文本框看起来很好......我没有找到任何其他选项..我想要一个网格,但不知道如何制作一个。

Hi guys
I am trying to make my asignment but have got stucked. I need help to get an idea how to present the scores. I have made same kind of program in console mode. and there I printed every turn for each player

player1
turn 1 2 3 4 5 6
10 20 11 10 11 7 and so on
8 20 20 16 18 19
12 1 1 19 20 1



Thanks

Johan

What I have tried:

is there a nice way to present the scores in a winform?? I dont think textbox look nice ... and I dont find any other option.. I want a grid but dont know how to make one.

推荐答案

尝试一个DataGridView :它们非常简单,您可以将它们基于您的某个类的集合:创建一个类,该类具有您要显示的每个列的公共属性,并创建它的列表。

然后,您可以使用List作为DataGridView的DataSource属性,它将以列的形式显示信息。

如果要添加一行Turn 4,Score 18,Remain 277只需创建该类的新实例,将其添加到List,并在DataGridView上调用Refresh。

DataGridView类(System.Windows.Forms) [ ^ ]

这样做更容易一个来描述,真的!
Try a DataGridView: they are pretty easy, and you can base them on a Collection of one of your classes: Create a class which has a public property for each column you want to display, and create a List of it.
You can then use the List as the DataSource property of the DataGridView and it will display the info as columns.
When you want to add a row "Turn 4, Score 18, Remain 277" Just create a new instance of the class, add it to the List, and call Refresh on the DataGridView.
DataGridView Class (System.Windows.Forms)[^]
It's easier to do than to describe, really!


这篇关于我正在尝试制作飞镖游戏,例如301。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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