0
全部我想在運行時構建和顯示由horizontol Splitter
s分隔的多個DataGridView
。爲了測試出這樣我已經創建了下面的代碼以編程方式對接/顯示多個具有分離器的DataGridViews
private void button1_Click(object sender, EventArgs e)
{
int i = 1;
List<DataGridView> DgvList = new List<DataGridView>()
{
new DataGridView(), new DataGridView()
};
foreach (DataGridView Dgv in DgvList)
{
Dgv.Parent = this.panelMain;
int verticalSize = (int)(panelMain.Height/DgvList.Count);
Dgv.Height = verticalSize;
Dgv.Dock = DockStyle.Top;
if (DgvList.Count > 1 && i < DgvList.Count)
{
Splitter tmpSplitter = new Splitter();
tmpSplitter.Parent = this.panelMain;
tmpSplitter.Dock = DockStyle.Top;
tmpSplitter.BringToFront();
tmpSplitter.Height = 8;
}
i++;
}
}
但是一個測試程序,這是不顯示Splitter
有人能突出我的方法錯誤?
謝謝你的時間。