[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public int[] GetRowHeights();
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public int[] GetColumnWidths();
Even though the GetRowHeights method is not visible it completely valid to use the method in the code. The previous code snippet is part of the code behind of the following Windows Form:
The previous screenshot shows a Windows Forms TableLayoutPanel control containing five rows and three columns: The left column contains a Label in each row of the column and the middle column contains a TextBox in each row of the column. The right column contains no controls.
By clicking on the NumericUpDown control labeled, "Number of Rows to Show", the number of visible rows associated with the TableLayoutPanel control can be changed by summing the heights of the visible rows and assigning the height of the TableLayoutPanel to be equal to the height of all visible rows. The code for handling this as follows, specifically the SetVisibleRows method:
The previous code only works because each row within the TableLayoutPanel control is set to an absolute pixel width. If the rows were set to be 20% each then changing the table height would not hide rows within the table.
An example of the application displaying two visible rows is as follows:
GetRowHeights was shown to be extremely handy but for some unknown reason Microsoft has choosen to hide this method GetRowHeights and its counterpart, GetColumnsWidths, from developers.
No comments :
Post a Comment