您好,您可以在切换tab时判断是否需要显示关闭按钮,同时你也可以在关闭事件中取消关闭。
- c1DockingTab1.SelectedIndexChanged += C1DockingTab1_SelectedIndexChanged;
- c1DockingTab1.TabPageClosed += C1DockingTab1_TabPageClosed;
- }
- private void C1DockingTab1_TabPageClosed(object sender, C1.Win.C1Command.TabPageEventArgs e)
- {
- if (c1DockingTab1.SelectedIndex == 0)
- {
- c1DockingTab1.CanCloseTabs = false;
- }
- }
- private void C1DockingTab1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (c1DockingTab1.SelectedIndex == 0)
- {
- c1DockingTab1.CanCloseTabs = false;
- }
- else
- {
- c1DockingTab1.CanCloseTabs = true;
- }
- }
- private void C1DockingTab1_TabPageClosing(object sender, C1.Win.C1Command.TabPageCancelEventArgs e)
- {
- if (e.TabPage.CaptionText == "Page1")
- {
- e.Cancel = true;
- }
- }
复制代码 |