Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d1cf5a5a
由
HZH
编写于
2019-09-16 17:39:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
treeview支持复选框
1 个父辈
385f3f0a
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
33 行增加
和
7 行删除
HZH_Controls/HZH_Controls/Controls/List/TreeViewEx.cs
HZH_Controls/HZH_Controls/Controls/List/UCListView.cs
HZH_Controls/Test/Form1.Designer.cs
HZH_Controls/Test/Form1.cs
HZH_Controls/HZH_Controls/Controls/List/TreeViewEx.cs
查看文件 @
d1cf5a5
...
...
@@ -19,6 +19,7 @@ using System.Collections.Generic;
using
System.ComponentModel
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Text
;
...
...
@@ -506,12 +507,14 @@ namespace HZH_Controls.Controls
{
try
{
if
(
e
.
Node
==
null
||
!
this
.
_isShowByCustomModel
||
(
e
.
Node
.
Bounds
.
Width
<=
0
&&
e
.
Node
.
Bounds
.
Height
<=
0
&&
e
.
Node
.
Bounds
.
X
<=
0
&&
e
.
Node
.
Bounds
.
Y
<=
0
))
{
e
.
DrawDefault
=
true
;
}
else
{
e
.
Graphics
.
SetGDIHigh
();
if
(
base
.
Nodes
.
IndexOf
(
e
.
Node
)
==
0
)
{
this
.
blnHasVBar
=
this
.
IsVerticalScrollBarVisible
();
...
...
@@ -526,21 +529,46 @@ namespace HZH_Controls.Controls
this
.
treeFontSize
=
this
.
GetFontSize
(
font
,
e
.
Graphics
);
}
bool
flag
=
false
;
int
num
=
0
;
if
(
base
.
ImageList
!=
null
&&
base
.
ImageList
.
Images
.
Count
>
0
&&
e
.
Node
.
ImageIndex
>=
0
&&
e
.
Node
.
ImageIndex
<
base
.
ImageList
.
Images
.
Count
)
{
flag
=
true
;
num
=
(
e
.
Bounds
.
Height
-
base
.
ImageList
.
ImageSize
.
Height
)
/
2
;
}
int
intLeft
=
0
;
if
(
CheckBoxes
)
{
intLeft
=
20
;
}
intLeft
+=
e
.
Node
.
Level
*
20
;
if
((
e
.
State
==
TreeNodeStates
.
Selected
||
e
.
State
==
TreeNodeStates
.
Focused
||
e
.
State
==
(
TreeNodeStates
.
Focused
|
TreeNodeStates
.
Selected
))
&&
(
this
.
_parentNodeCanSelect
||
e
.
Node
.
Nodes
.
Count
<=
0
))
{
e
.
Graphics
.
FillRectangle
(
new
SolidBrush
(
this
.
m_nodeSelectedColor
),
new
Rectangle
(
new
Point
(
0
,
e
.
Node
.
Bounds
.
Y
),
new
Size
(
base
.
Width
,
e
.
Node
.
Bounds
.
Height
)));
e
.
Graphics
.
DrawString
(
e
.
Node
.
Text
,
font
,
new
SolidBrush
(
this
.
m_nodeSelectedForeColor
),
(
float
)
e
.
Bounds
.
X
,
(
float
)
e
.
Bounds
.
Y
+
((
float
)
this
.
_nodeHeight
-
this
.
treeFontSize
.
Height
)
/
2f
);
e
.
Graphics
.
DrawString
(
e
.
Node
.
Text
,
font
,
new
SolidBrush
(
this
.
m_nodeSelectedForeColor
),
(
float
)
e
.
Bounds
.
X
+
intLeft
,
(
float
)
e
.
Bounds
.
Y
+
((
float
)
this
.
_nodeHeight
-
this
.
treeFontSize
.
Height
)
/
2f
);
}
else
{
e
.
Graphics
.
FillRectangle
(
new
SolidBrush
(
this
.
_nodeBackgroundColor
),
new
Rectangle
(
new
Point
(
0
,
e
.
Node
.
Bounds
.
Y
),
new
Size
(
base
.
Width
,
e
.
Node
.
Bounds
.
Height
)));
e
.
Graphics
.
DrawString
(
e
.
Node
.
Text
,
font
,
new
SolidBrush
(
this
.
_nodeForeColor
),
(
float
)
e
.
Bounds
.
X
,
(
float
)
e
.
Bounds
.
Y
+
((
float
)
this
.
_nodeHeight
-
this
.
treeFontSize
.
Height
)
/
2f
);
e
.
Graphics
.
DrawString
(
e
.
Node
.
Text
,
font
,
new
SolidBrush
(
this
.
_nodeForeColor
),
(
float
)
e
.
Bounds
.
X
+
intLeft
,
(
float
)
e
.
Bounds
.
Y
+
((
float
)
this
.
_nodeHeight
-
this
.
treeFontSize
.
Height
)
/
2f
);
}
if
(
CheckBoxes
)
{
Rectangle
rectCheck
=
new
Rectangle
(
e
.
Bounds
.
X
+
3
+
e
.
Node
.
Level
*
20
,
e
.
Bounds
.
Y
+
(
e
.
Bounds
.
Height
-
16
)
/
2
,
16
,
16
);
GraphicsPath
pathCheck
=
rectCheck
.
CreateRoundedRectanglePath
(
3
);
e
.
Graphics
.
FillPath
(
new
SolidBrush
(
Color
.
FromArgb
(
247
,
247
,
247
)),
pathCheck
);
if
(
e
.
Node
.
Checked
)
{
e
.
Graphics
.
DrawLines
(
new
Pen
(
new
SolidBrush
(
m_nodeSelectedColor
),
2
),
new
Point
[]
{
new
Point
(
rectCheck
.
Left
+
2
,
rectCheck
.
Top
+
8
),
new
Point
(
rectCheck
.
Left
+
6
,
rectCheck
.
Top
+
12
),
new
Point
(
rectCheck
.
Right
-
4
,
rectCheck
.
Top
+
4
)
});
}
e
.
Graphics
.
DrawPath
(
new
Pen
(
new
SolidBrush
(
Color
.
FromArgb
(
200
,
200
,
200
))),
pathCheck
);
}
if
(
flag
)
{
...
...
@@ -549,7 +577,7 @@ namespace HZH_Controls.Controls
{
num2
=
3
;
}
e
.
Graphics
.
DrawImage
(
base
.
ImageList
.
Images
[
e
.
Node
.
ImageIndex
],
new
Rectangle
(
new
Point
(
num2
,
e
.
Bounds
.
Y
+
num
),
base
.
ImageList
.
ImageSize
));
e
.
Graphics
.
DrawImage
(
base
.
ImageList
.
Images
[
e
.
Node
.
ImageIndex
],
new
Rectangle
(
new
Point
(
num2
+
intLeft
,
e
.
Bounds
.
Y
+
num
),
base
.
ImageList
.
ImageSize
));
}
if
(
this
.
_nodeIsShowSplitLine
)
{
...
...
HZH_Controls/HZH_Controls/Controls/List/UCListView.cs
查看文件 @
d1cf5a5
...
...
@@ -105,8 +105,6 @@ namespace HZH_Controls.Controls
}
}
/// <summary>
/// The m data source
/// </summary>
...
...
HZH_Controls/Test/Form1.Designer.cs
查看文件 @
d1cf5a5
此文件的差异被折叠,
点击展开。
HZH_Controls/Test/Form1.cs
查看文件 @
d1cf5a5
...
...
@@ -24,10 +24,10 @@ namespace Test
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
TreeNode
tn
=
new
TreeNode
(
"
父节点"
+
i
);
TreeNode
tn
=
new
TreeNode
(
"父节点"
+
i
);
for
(
int
j
=
0
;
j
<
3
;
j
++)
{
tn
.
Nodes
.
Add
(
"
子节点"
+
j
);
tn
.
Nodes
.
Add
(
"子节点"
+
j
);
}
this
.
treeViewEx1
.
Nodes
.
Add
(
tn
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论