winform TabControl 添加关闭按钮 Add close button to TabControl TabPages - C#
2016-09-22 17:39
701 查看
<h1 class="articleTitle" style="font-family: 'Open Sans', Tahoma, Arial, Helvetica, sans-serif; margin: 0px 0px 10px; font-size: 22px; text-shadow: rgb(204, 204, 204) 2px 2px 3px; color: rgb(0, 0, 0); padding: 5px 10px; font-weight: normal; text-align: left; width: 590px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);">How to Add a Close Button to Tabs in TabControl?</h1> // Create a command button // Set the ImageIndex property to show the second image from the list // Set the Key property to TAB_CLOSE, so we can identify what kind of a button was clicked LidorSystems.IntegralUI.Controls.CommandButton closeButton = new LidorSystems.IntegralUI.Controls.CommandButton(); closeButton.ImageIndex = 1; closeButton.Key = "TAB_CLOSE"; // In this demo we are using only one command button // If the button collection is empty, add the close button to it if (this.tabControl1.TabButtons.Count == 0) this.tabControl1.TabButtons.Add(closeButton);
// Check whether there is some tab on top (selected) if (this.tabControl1.SelectedPage != null) { // Create a command button // Set the ImageIndex property to show the first image from the list // Set the Key property to TAB_CLOSE, so we can identify what kind of a button was clicked LidorSystems.IntegralUI.Controls.CommandButton closeButton = new LidorSystems.IntegralUI.Controls.CommandButton(); closeButton.ImageIndex = 0; closeButton.Key = "TAB_CLOSE"; // In this demo we are using only one command button // If the button collection is empty, add the close button to it if (this.tabControl1.SelectedPage.Buttons.Count == 0) this.tabControl1.SelectedPage.Buttons.Add(closeButton); this.tabControl1.SelectedPage.UseParentButtons = false; // Update the control layout to apply changes this.tabControl1.UpdateLayout(); }
更多信息:
http://www.lidorsystems.com/support/articles/winforms/tabcontrol/tab-close-button.aspx
相关文章推荐
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- C# 重绘tabControl,添加关闭按钮(页签)
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- C# 重绘tabControl,添加关闭按钮(续)
- C#重绘TabControl的Tabpage标签,添加图片及关闭按钮
- TabControl添加关闭按钮
- 在Telerik RadTabControl中的Tab Header添加关闭按钮
- TabControl添加关闭按钮
- 【组件修改】winform某个tabcontrol控件的修改--加上关闭按钮
- C#之WinForm基础 点击button关闭当前窗体,用this.close()
- TabControl添加关闭按钮
- c# winform 点击按钮切换tabcontrol标签
- 重新绘制TabControl的Tabpage标签,添加图片及关闭按钮
- c#重写TabControl控件实现关闭按钮的方法
- Winform -----TabControl 标签 画关闭按钮
- 重新绘制TabControl的Tabpage标签,添加图片及关闭按钮
- 给TabControl的Page添加个关闭按钮