c# - Having problems with Adding multiple labels in a for loop -
ok i've been trying add list of labels show points in yahtzee game. im having problems tho change number of players should add still won't add list of them.
http://fuskbugg.se/dl/sn0umk/yahtzee_help.jpg (i want list next player: 1 2 3 etc.) im trying accomplish.
here code player class
constructor
public player(int playerid, form game) { id = playerid; (int = 0; < points.length; i++) { points[i] = new label(); points[i].text = "_"; points[i].location = new point(112+(id)*30, 80+(i)*29); messagebox.show((112 + (id) * 28)+" "+( 80 + (i) * 29) + ""); game.controls.add(points[i]); nottaken[i] = true; } }
nottaken irrelevent.
game code adds amount of players.
public void start(int players) { this.enabled = true; (int = 0; < players; i++) { playerlist.add(new player(i, this)); label newlbl = new label(); this.controls.add(newlbl); newlbl.text = (i + 1) + ""; newlbl.location = new point(112 + (i * 28), 56); } }
any on appreciated
sorted out. thing when added labels created in standard size led them overlaying each other added 1 line.
points[i].size = new size(19, 13);
Comments
Post a Comment