ArtK
ArtK

Reputation: 1185

Table Layout Control Position

Controls in TableLayoutPanel get additional properties that are accessible in IDE. One is Row and another is Column, relative to TableLayoutPanel.

How do I get those properties' values by code?

I need to loop through all controls in my TableLayoutPanel and issue instructions based on their relative positions; but when I cast retrieved controls as a specific type, I don't get Row and Column properties.

Upvotes: 0

Views: 2356

Answers (1)

user3708917
user3708917

Reputation:

You need to do it the other way around. Use TableLayoutPanel.GetCellPosition(Control c) method and pass your control to the method. Assign the return value to TableLayoutPanelCellPosition class variable. That object has Row and Column properties that return integer values.

Upvotes: 2

Related Questions