[Mono-winforms-list] GetColumn problem

Jonathan Pobst monkey at jpobst.com
Thu Sep 17 10:11:55 EDT 2009


PFJ wrote:
> I have created a TLP in the designer which contains 6 rows and 1 column. The
> column contains the days of the week and a blank at the top.
> 
> The user enters the number of columns they want (1 to 10) and the program
> creates them using the code I've posted. On Row0, the labels saying the
> lesson number are added in. There are no other labels in anywhere else.
> 
> What I'm trying to do is when the TLP is clicked, that the program finds the
> row and column for use elsewhere in the application.
> 
> My current efforts *always* return -1 when using GetColumn or
> GetPositionFromControl. I'm assuming it's giving -1 as there is nothing
> inside of the layout blocks other than the labels in row 0 and column 0.

Yeah, GetColumn/GetPositionFromControl are designed to find where a 
Control is in the TableLayoutPanel.  I don't think there's much that 
helps you use TLP as just a grid.

You will probably need to use GetColumnWidths and GetRowHeights to 
calculate which col/row was clicked using the mouse coordinates from 
MouseClick.

Jonathan


More information about the Mono-winforms-list mailing list