I’ve made in Visual Studio 2010 in designer mode a TableLayoutPanel (for example 8×8 rowsxcolumns), then I’ve put in each field of this “matrix” a button. Is there any way how to handle the events centrally? I found that TableLayoutPanel have TabIndexChanged, but I don’t know if this will be useful for me.
I’m just trying to find out if is possible this:
I click on second button and get the information on what button I’ve clicked and will be able to change some of his property – for example icon, or text.
Lets imagine an idea that I will understand tablelayoutpanel as an “matrix” or “array” and I want to work with it something like this:
1)I'll click on button on possition i (or i,j)
2)I'll change the Icon of button on possition i (or i,j)
Is that possible? If yes, how?
Thx
You can have a single method handle all your button click events and then use the sender parameter to modify the image on the button.
e.g.
As an aside the
TabIndexChangedwould be completely useless to you since its only raised when the TabIndex property of a control gets changed which is typically very rare. You’ll rember that the TabIndex property is used to control the order of controls for when the user presses the Tab key.