How to Create a grid of buttons

krazineurons

New member
Joined
Jun 11, 2007
Messages
2
Programming Experience
1-3
Hi friends, i plan to develop a solution to the Eight Queens Puzzle. Now i got the code to work in VB.NET 2005 however i thought of learining Expressions Blend with the help of making a solver in it. So i thought of the following idea.

I'l put a 8x8 board with 64 buttons on it. Say the user puts a queen on one of the buttons then in that case all the buttons where the queen can attack should change their background color, (initially Red) and should change to Green. I wanted some thing like this:-


in the buttons' click event i want the following code (something similar)

retrive list of all coordinates which fall in the attack zone of the selected button, (i get the list of all horizontal, vertical and diagonal coordinates) in the form of (Row,Column) -> this code part is done



now the real problem. As i said earlier i want a grid of buttons in such a way that i can access every button in the way:-



Button(Row,Column) - I can directly pass the Row,Column value and the corresponding button will change it's background color like a function change_color(row,column) where in button(row,column).backcolor = "Green"


NOW HOW DO I CREATE SUCH GRID OF BUTTONS IN EXPRESSIONS BLEND? in vb i used to work with control arrays, is there anything like that or simpler than that in Expressions Blend.



Any further suggestions are alse welcome which can improvise my idea or a new methods are also welcome..please help me asap!



Thanx and Regards
Anirudh
 
it's still possible to create an array of buttons, you can't do it in the designer like in vb6. I would declare the array of buttons at the module level, then in the form's load event simply set each element in the array to a new instance of button and set it's top and left property to where they all should be.
 
Back
Top