资源简介
C#,Winform TabControl重写(添加关闭与添加按钮鼠标移动变色功能),可自定义添加按钮及样式
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VideoBrowser.Properties;
namespace VideoBrowser.UI
{
public partial class MenuTabControl : System.Windows.Forms.TabControl
{
public MenuTabControl()
{
InitializeComponent();
TabSet();
}
private void InitializeComponent()
{
this.SuspendLayout();
this.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tabMenu_DrawItem);
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MainTabControl_MouseDown);
this.ResumeLayout(false);
}
public void AddPage(MouseEventArgs eTabPage page)
{
if (e.Button == MouseButtons.Left)
{
int x = e.X y = e.Y;
Rectangle r = this.GetTabRect(0);
int tx = (int)((r.Width * this.TabCount));
r.Offset(tx 0);
r.Width = 30;
r.Height = 30;
int longw=((this.TabCount+1) * this.ItemSize.Width + 30);
if (this.Width < longw)
{
page.Dispose();
return;
}
bool isAdd = x > r.X && x < r.Right && y > r.Y && y < r.Bottom;
if (isAdd)
{
this.Controls.Add(page);
}
else
{
page.Dispose();
}
}
}
Color SelectedColor = Color.LightSkyBlue;
Color MoveColor = Color.White;
Color FontColor = Color.Black;
int TextLeft = 10;
[Browsable(true)]
[Description(“选项卡标题左边距“) Category(“TextLeft“) DefaultValue(typeof(Int32) “10“)]
public int titleTextLeft
{
get
{
return TextLeft;
}
set
{
this.TextLeft = value;
}
}
[Browsable(true)]
[Description(“选项卡标题字体颜色“) Category(“titleColor“) DefaultValue(typeof(Color) “Black“)]
public Color titleFontColor
{
get
{
return FontColor;
}
set
{
this.FontColor = value;
}
}
[Browsable(true)]
[Description(“选项卡标题字体选中颜色“) Category(“titleColor“) DefaultValue(typeof(Color) “LightSkyBlue“)]
public Color titleSelectedColor
{
get
{
return SelectedColor;
}
set
{
this.SelectedColor = valu
- 上一篇:一个简单的二维几何类
- 下一篇:餐厅点餐系统设计,毕设
相关资源
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
评论
共有 条评论