我有一些標籤打開並且每個標籤頁都處於監禁狀態。 我想通過點擊表格中的按鈕在當前標籤頁中打開另一個標籤頁,並且當前標籤的文本將會更改。 我用下面的代碼,這樣,如果按下按鈕,當前標籤頁變化的名稱:C#文本不會在tabcontrol的tabpage中更改
private void buttonNewForm_Click(object sender, EventArgs e)
{
newForm childForm = new newForm(tbc1);
//TopLevel for form is set to false
childForm.TopLevel = false;
//select current TabPage
int curr = tbc1.SelectedIndex;
TabPage tbp = tbc1.TabPages[curr];
tbc1.TabPages[curr].Text = "name of new form";
tbp.Controls.Add(childForm);
//Added form to tabpage
childForm.WindowState = FormWindowState.Maximized;
childForm.Show();
Refresh();
}
它運作良好,直到我把代碼中的主要形式,將阻止我閃爍標籤的一段話:
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
如何在不刪除防止閃爍的代碼的情況下再次工作?
。你是否想在標籤頁中打開另一個表單,或者想要使用表格形式構建一個與google chrome瀏覽器類似的應用程序? – Shell
這裏需要適當的歸屬。也是讓這個人關注你的帖子的好方法。 –