Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6c8e33f5
由
kwwwvagaa
编写于
2020-09-04 20:02:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改树表格获取选中行问题
1 个父辈
969d38ae
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
41 行增加
和
8 行删除
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridViewTreeRow.cs
HZH_Controls/Test/UC/UCTestTreeGridTable.Designer.cs
HZH_Controls/Test/UC/UCTestTreeGridTable.cs
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
查看文件 @
6c8e33f
...
...
@@ -316,19 +316,28 @@ namespace HZH_Controls.Controls
if
(
m_selectRow
!=
null
)
lst
.
AddRange
(
new
List
<
IDataGridViewRow
>()
{
m_selectRow
});
}
if
(
Rows
!=
null
&&
Rows
.
Count
>
0
)
if
(
Rows
!=
null
&&
Rows
.
Count
>
0
&&
m_rowType
==
typeof
(
UCDataGridViewTreeRow
)
)
{
foreach
(
var
row
in
Rows
)
foreach
(
UCDataGridViewTreeRow
row
in
Rows
)
{
Control
c
=
row
as
Control
;
UCDataGridView
grid
=
FindChildGrid
(
c
);
if
(
grid
!=
null
)
lst
.
AddRange
(
grid
.
SelectRows
);
lst
.
AddRange
(
FindTreeRowSelected
(
row
));
}
}
return
lst
;
}
private
List
<
IDataGridViewRow
>
FindTreeRowSelected
(
UCDataGridViewTreeRow
row
)
{
List
<
IDataGridViewRow
>
lst
=
new
List
<
IDataGridViewRow
>();
var
_lst
=
row
.
ChildrenRows
.
FindAll
(
p
=>
p
.
IsChecked
);
lst
.
AddRange
(
_lst
);
foreach
(
UCDataGridViewTreeRow
_row
in
row
.
ChildrenRows
)
{
lst
.
AddRange
(
FindTreeRowSelected
(
_row
));
}
return
lst
;
}
/// <summary>
/// Finds the child grid.
/// </summary>
...
...
@@ -613,7 +622,7 @@ namespace HZH_Controls.Controls
Rows
.
Add
(
row
);
row
.
RowIndex
=
Rows
.
IndexOf
(
row
);
this
.
panRow
.
Controls
.
Add
(
rowControl
);
}
}
...
...
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridViewTreeRow.cs
查看文件 @
6c8e33f
...
...
@@ -313,6 +313,7 @@ namespace HZH_Controls.Controls
box
.
TextValue
=
""
;
box
.
Size
=
new
Size
(
30
,
30
);
box
.
Dock
=
DockStyle
.
Fill
;
box
.
CheckedChangeEvent
+=
box_CheckedChangeEvent
;
c
=
box
;
}
else
...
...
@@ -357,6 +358,11 @@ namespace HZH_Controls.Controls
}
}
void
box_CheckedChangeEvent
(
object
sender
,
EventArgs
e
)
{
IsChecked
=
((
UCCheckBox
)
sender
).
Checked
;
}
/// <summary>
...
...
HZH_Controls/Test/UC/UCTestTreeGridTable.Designer.cs
查看文件 @
6c8e33f
...
...
@@ -30,11 +30,11 @@
{
this
.
ucDataGridView1
=
new
HZH_Controls
.
Controls
.
UCDataGridView
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
SuspendLayout
();
//
// ucDataGridView1
//
this
.
ucDataGridView1
.
AutoScroll
=
true
;
this
.
ucDataGridView1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucDataGridView1
.
Columns
=
null
;
this
.
ucDataGridView1
.
DataSource
=
null
;
...
...
@@ -46,6 +46,7 @@
this
.
ucDataGridView1
.
IsShowHead
=
true
;
this
.
ucDataGridView1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
ucDataGridView1
.
Name
=
"ucDataGridView1"
;
this
.
ucDataGridView1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
40
,
0
,
0
);
this
.
ucDataGridView1
.
RowHeight
=
41
;
this
.
ucDataGridView1
.
RowType
=
typeof
(
HZH_Controls
.
Controls
.
UCDataGridViewRow
);
this
.
ucDataGridView1
.
Size
=
new
System
.
Drawing
.
Size
(
807
,
655
);
...
...
@@ -60,10 +61,21 @@
this
.
label1
.
TabIndex
=
6
;
this
.
label1
.
Text
=
"*树表格第一列将作为展开缩进处理,请根据实际情况设置具体像素的宽度,请勿使用百分比宽度"
;
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
591
,
677
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
91
,
23
);
this
.
button1
.
TabIndex
=
7
;
this
.
button1
.
Text
=
"获取选中行"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// UCTestTreeGridTable
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
label1
);
this
.
Controls
.
Add
(
this
.
ucDataGridView1
);
this
.
Name
=
"UCTestTreeGridTable"
;
...
...
@@ -78,5 +90,6 @@
private
HZH_Controls
.
Controls
.
UCDataGridView
ucDataGridView1
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
Button
button1
;
}
}
HZH_Controls/Test/UC/UCTestTreeGridTable.cs
查看文件 @
6c8e33f
...
...
@@ -67,5 +67,10 @@ namespace Test.UC
AddChilds
(
model
,
intCount
-
1
);
}
}
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
var
c
=
this
.
ucDataGridView1
.
SelectRows
.
Count
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论