0
我有一個TabControl
,我正在編程上在它上面添加一個Form
,其上的GridView
控件添加到Tab控件Controls
集合中。結果是這樣的:滾動條不留在Winforms選項卡控件中的客戶區域內
GridView控件圖中居然有大約150列...當我使用水平滾動條滾動的權利,我得到這個:
請注意,滾動條不在選項卡的可見客戶端區域中。相反,滾動條呈現嵌入表單的寬度。
如何讓滾動條呈現標籤中可見客戶區的寬度?
這是我的代碼。 PcmEditorForm
只是一個空白表格,與FormBorderStyle
設置爲無,並有一些代碼,將我們在這裏不會顯示網格中的行和列數:
private void LoadEditorTab()
{
var editor = new PcmEditorForm();
var grid = new GridView();
editor.Width = grid.Width;
editor.Height = grid.Height;
editor.Controls.Add(grid);
editor.AutoScroll = true;
editor.Anchor = AnchorStyles.Left | AnchorStyles.Top;
tabEdit.Controls.Clear();
editor.TopLevel = false;
editor.Visible = true;
tabEdit.Controls.Add(editor);
}
'Dockstyle.Fill'沒有辦法。錨樣式似乎並不重要。 –