电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

像火狐浏览器的Tab

像火狐浏览器的Tab_第1页
1/11
像火狐浏览器的Tab_第2页
2/11
像火狐浏览器的Tab_第3页
3/11
像火狐浏览器的Tab Control 控件 爱国者发表于2007 年09 月09 日 查看(1936)|评论(1) 文章收录于:【翻译】像火狐浏览器的Tab Control 控件 【翻译】 vijayaprasen.著FireFox-like Tab Control 【简介】 目 前,我需要完成一个Tab Control,它需要允许用户不在任何Tab 页的时候,都能直接关闭它。完成这样功能的最完美的例子就是火狐浏览器上的那个了。在FireFox 中,用 户可以打开足够多的Tab 页,他还可以在任何时候关闭没有正在打开的Tab。我尝试Google 一下,没有发现好的解决方案,于是产生了这篇文章——这个 控件。 【代码使用】 设计人员可以和普通标准 tab 控件一样,添加删除 tab 页。支持这样功能的类是: 1. TabCtlEx.cs (继承于System.Windows.Forms.TabControl) 2. TabPage.cs (继承于System.Windows.Forms.TabPage) 使用该控件是非常简单的,和标准的.NET TAB 控件一样: private MyControlLibrary.TabCtlEx userControl11; TabPageEx tabPage1; TabPageEx tabPage2; TabPageEx tabPage3; private TabPageEx tabPage4; this .userControl11 = new MyControlLibrary.TabCtlEx(); this .tabPage1 = new MyControlLibrary.TabPageEx(this .components); this .tabPage2 = new MyControlLibrary.TabPageEx(this .components); this .tabPage3 = new MyControlLibrary.TabPageEx(this .components); this .tabPage4 = new MyControlLibrary.TabPageEx(this .components); this .Controls.Add(this. userControl11); 在每个Tab 旁绘制关闭按钮 为了这个功能,你需要重载.NET TAB 控件已存在的OnDrawItem() 方法。 /// /// override to draw the close button /// /// protected override void OnDrawItem(DrawItemEventArgs e) { RectangleF tabTextArea = RectangleF.Empty; for (int nIndex = 0 ; nIndex < this .TabCount ; nIndex++) { if( nIndex != this.SelectedIndex ) { /*if not active draw ,inactive close button*/ tabTextArea = (RectangleF)this.GetTabRect(nIndex); using (Bitmap bmp = new Bitmap(GetContentFromResource( "closeinactive.bmp"))) { e.Graphics.DrawImage(bmp, tabTextArea.X+tabTextArea.Width -16, 5, 13, 13); } } else { tabTex...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

像火狐浏览器的Tab

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部