Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b4132c6a
由
kwwwvagaa
编写于
2020-04-22 21:35:33 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加选项卡不可关闭功能
1 个父辈
09e1bd73
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
42 行增加
和
6 行删除
HZH_Controls/HZH_Controls/Controls/Tab/TabControlExt.cs
HZH_Controls/Test/UC/UCTestTab.Designer.cs
HZH_Controls/Test/UC/UCTestTreeGridTable.Designer.cs
HZH_Controls/HZH_Controls/Controls/Tab/TabControlExt.cs
查看文件 @
b4132c6
...
@@ -64,6 +64,8 @@ namespace HZH_Controls.Controls
...
@@ -64,6 +64,8 @@ namespace HZH_Controls.Controls
[
Description
(
"是否显示关闭按钮"
),
Category
(
"自定义"
)]
[
Description
(
"是否显示关闭按钮"
),
Category
(
"自定义"
)]
public
bool
IsShowCloseBtn
{
get
;
set
;
}
public
bool
IsShowCloseBtn
{
get
;
set
;
}
[
Description
(
"不可关闭的标签序号列表,下标0"
),
Category
(
"自定义"
)]
public
int
[]
UncloseTabIndexs
{
get
;
set
;
}
/// <summary>
/// <summary>
/// The back color
/// The back color
/// </summary>
/// </summary>
...
@@ -85,6 +87,15 @@ namespace HZH_Controls.Controls
...
@@ -85,6 +87,15 @@ namespace HZH_Controls.Controls
}
}
}
}
private
Color
closeBtnColor
=
Color
.
FromArgb
(
255
,
85
,
51
);
[
Description
(
"关闭按钮颜色"
)]
public
Color
CloseBtnColor
{
get
{
return
closeBtnColor
;
}
set
{
closeBtnColor
=
value
;
}
}
/// <summary>
/// <summary>
/// The border color
/// The border color
/// </summary>
/// </summary>
...
@@ -257,9 +268,14 @@ namespace HZH_Controls.Controls
...
@@ -257,9 +268,14 @@ namespace HZH_Controls.Controls
this
.
PaintTabImage
(
e
.
Graphics
,
index
);
this
.
PaintTabImage
(
e
.
Graphics
,
index
);
if
(
IsShowCloseBtn
)
if
(
IsShowCloseBtn
)
{
{
if
(
UncloseTabIndexs
!=
null
)
{
if
(
UncloseTabIndexs
.
ToList
().
Contains
(
index
))
return
;
}
Rectangle
rect
=
this
.
GetTabRect
(
index
);
Rectangle
rect
=
this
.
GetTabRect
(
index
);
e
.
Graphics
.
DrawLine
(
new
Pen
(
_border
Color
,
1F
),
new
Point
(
rect
.
Right
-
15
,
rect
.
Top
+
5
),
new
Point
(
rect
.
Right
-
5
,
rect
.
Top
+
15
));
e
.
Graphics
.
DrawLine
(
new
Pen
(
closeBtn
Color
,
1F
),
new
Point
(
rect
.
Right
-
15
,
rect
.
Top
+
5
),
new
Point
(
rect
.
Right
-
5
,
rect
.
Top
+
15
));
e
.
Graphics
.
DrawLine
(
new
Pen
(
_border
Color
,
1F
),
new
Point
(
rect
.
Right
-
5
,
rect
.
Top
+
5
),
new
Point
(
rect
.
Right
-
15
,
rect
.
Top
+
15
));
e
.
Graphics
.
DrawLine
(
new
Pen
(
closeBtn
Color
,
1F
),
new
Point
(
rect
.
Right
-
5
,
rect
.
Top
+
5
),
new
Point
(
rect
.
Right
-
15
,
rect
.
Top
+
15
));
}
}
}
}
...
@@ -489,6 +505,11 @@ namespace HZH_Controls.Controls
...
@@ -489,6 +505,11 @@ namespace HZH_Controls.Controls
int
index
=
GetMouseDownTabHead
(
mouseLocation
);
int
index
=
GetMouseDownTabHead
(
mouseLocation
);
if
(
index
>=
0
)
if
(
index
>=
0
)
{
{
if
(
UncloseTabIndexs
!=
null
)
{
if
(
UncloseTabIndexs
.
ToList
().
Contains
(
index
))
return
;
}
Rectangle
rect
=
this
.
GetTabRect
(
index
);
Rectangle
rect
=
this
.
GetTabRect
(
index
);
var
closeRect
=
new
Rectangle
(
rect
.
Right
-
15
,
rect
.
Top
+
5
,
10
,
10
);
var
closeRect
=
new
Rectangle
(
rect
.
Right
-
15
,
rect
.
Top
+
5
,
10
,
10
);
if
(
closeRect
.
Contains
(
mouseLocation
))
if
(
closeRect
.
Contains
(
mouseLocation
))
...
...
HZH_Controls/Test/UC/UCTestTab.Designer.cs
查看文件 @
b4132c6
...
@@ -64,6 +64,9 @@
...
@@ -64,6 +64,9 @@
this
.
tabControlExt1
.
Size
=
new
System
.
Drawing
.
Size
(
573
,
421
);
this
.
tabControlExt1
.
Size
=
new
System
.
Drawing
.
Size
(
573
,
421
);
this
.
tabControlExt1
.
SizeMode
=
System
.
Windows
.
Forms
.
TabSizeMode
.
FillToRight
;
this
.
tabControlExt1
.
SizeMode
=
System
.
Windows
.
Forms
.
TabSizeMode
.
FillToRight
;
this
.
tabControlExt1
.
TabIndex
=
1
;
this
.
tabControlExt1
.
TabIndex
=
1
;
this
.
tabControlExt1
.
UncloseTabIndexs
=
new
int
[]
{
0
,
1
};
//
//
// tabPage1
// tabPage1
//
//
...
...
HZH_Controls/Test/UC/UCTestTreeGridTable.Designer.cs
查看文件 @
b4132c6
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
private
void
InitializeComponent
()
private
void
InitializeComponent
()
{
{
this
.
ucDataGridView1
=
new
HZH_Controls
.
Controls
.
UCDataGridView
();
this
.
ucDataGridView1
=
new
HZH_Controls
.
Controls
.
UCDataGridView
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// ucDataGridView1
// ucDataGridView1
...
@@ -37,7 +38,6 @@
...
@@ -37,7 +38,6 @@
this
.
ucDataGridView1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucDataGridView1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucDataGridView1
.
Columns
=
null
;
this
.
ucDataGridView1
.
Columns
=
null
;
this
.
ucDataGridView1
.
DataSource
=
null
;
this
.
ucDataGridView1
.
DataSource
=
null
;
this
.
ucDataGridView1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
ucDataGridView1
.
HeadFont
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
);
this
.
ucDataGridView1
.
HeadFont
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
);
this
.
ucDataGridView1
.
HeadHeight
=
40
;
this
.
ucDataGridView1
.
HeadHeight
=
40
;
this
.
ucDataGridView1
.
HeadPadingLeft
=
24
;
this
.
ucDataGridView1
.
HeadPadingLeft
=
24
;
...
@@ -48,23 +48,35 @@
...
@@ -48,23 +48,35 @@
this
.
ucDataGridView1
.
Name
=
"ucDataGridView1"
;
this
.
ucDataGridView1
.
Name
=
"ucDataGridView1"
;
this
.
ucDataGridView1
.
RowHeight
=
41
;
this
.
ucDataGridView1
.
RowHeight
=
41
;
this
.
ucDataGridView1
.
RowType
=
typeof
(
HZH_Controls
.
Controls
.
UCDataGridViewRow
);
this
.
ucDataGridView1
.
RowType
=
typeof
(
HZH_Controls
.
Controls
.
UCDataGridViewRow
);
this
.
ucDataGridView1
.
Size
=
new
System
.
Drawing
.
Size
(
8
17
,
674
);
this
.
ucDataGridView1
.
Size
=
new
System
.
Drawing
.
Size
(
8
07
,
655
);
this
.
ucDataGridView1
.
TabIndex
=
5
;
this
.
ucDataGridView1
.
TabIndex
=
5
;
//
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
17
,
677
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
515
,
12
);
this
.
label1
.
TabIndex
=
6
;
this
.
label1
.
Text
=
"*树表格第一列将作为展开缩进处理,请根据实际情况设置具体像素的宽度,请勿使用百分比宽度"
;
//
// UCTestTreeGridTable
// UCTestTreeGridTable
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
ucDataGridView1
);
this
.
Controls
.
Add
(
this
.
ucDataGridView1
);
this
.
Name
=
"UCTestTreeGridTable"
;
this
.
Name
=
"UCTestTreeGridTable"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
817
,
67
4
);
this
.
Size
=
new
System
.
Drawing
.
Size
(
817
,
71
4
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
UCTestTreeGridTable_Load
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
UCTestTreeGridTable_Load
);
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
}
#
endregion
#
endregion
private
HZH_Controls
.
Controls
.
UCDataGridView
ucDataGridView1
;
private
HZH_Controls
.
Controls
.
UCDataGridView
ucDataGridView1
;
private
System
.
Windows
.
Forms
.
Label
label1
;
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论