表格布局的行自动调整属性不起作用? [英] Row Autosize property not working of Table Layout?
问题描述
我正在开发一个 Windows 应用程序,其中我使用了一个表格布局面板,在这个表格布局中我创建了 5 行并且是自动调整大小的,现在我动态地添加了 4 个单选按钮,单选按钮的文本是一个有点长,但问题是它表现得像绝对而不显示全文.
I am working on a windows application, in which i am using a table layout panel, in this table layout i have created 5 rows and that is autosize, now dynamically i am adding 4 radio buttons and text for radio button is a bit long but the problem is it is behaving like absolute and not showing the full text.
我正在添加这样的单选按钮-
I am adding radio button like this-
for (int i = 0; i < 4; i++)
{
rbtn1 = new RadioButton();
rbtn1.Name = "rbtn" + (i + 1);
rbtn1.Text = "A jogger running at 9 kmph alongside a railway track in 280 metres ahead of the engine of a 120 metres long train running at 45 kmph in the same direction. In how much time will the train pass the jogger?";//ansList[i].ToString();
rbtn1.Dock = DockStyle.Fill;
rbtn1.Font = new Font("Verdana", 10);
tableLayoutExamPanel.Controls.Add(rbtn1, 1, i + 8);
}
我在过去 10 个小时内一直在处理这个问题.
I am working on this from last 10 hours.
需要帮助,非常感谢.
推荐答案
我意识到这是一个老问题,但是:
I realise this is an old question, however:
- 将每个 RadioButton 的停靠样式设置为 DockStyle.None
- 为每个 RadioButton 设置 AutoSize = True.
如果您设置了停靠栏样式,则自动调整大小将不起作用.确保上面的内容适用于表格中的每个子控件.
Autosize won't work if you have a dock style set. Make sure you the above is true for each child control on the table.
这篇关于表格布局的行自动调整属性不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!