Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 57a8ef89
由
kwwwvagaa
编写于
2020-06-16 10:04:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化表格标题显示
1 个父辈
d4225c39
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
56 行增加
和
34 行删除
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.Designer.cs
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
HZH_Controls/HZH_Controls/HZH_Controls.nuspec
HZH_Controls/Test/UC/UCTestGridTable.Designer.cs
HZH_Controls/Test/UC/UCTestGridTable.cs
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.Designer.cs
查看文件 @
57a8ef8
...
...
@@ -51,8 +51,8 @@ namespace HZH_Controls.Controls
this
.
panHead
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
panColumns
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
panHeadLeft
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
panRow
=
new
System
.
Windows
.
Forms
.
FlowLayoutPanel
();
this
.
ucSplitLine_H1
=
new
HZH_Controls
.
Controls
.
UCSplitLine_H
();
this
.
panRow
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
panHead
.
SuspendLayout
();
this
.
SuspendLayout
();
//
...
...
@@ -87,6 +87,16 @@ namespace HZH_Controls.Controls
this
.
panHeadLeft
.
Size
=
new
System
.
Drawing
.
Size
(
0
,
39
);
this
.
panHeadLeft
.
TabIndex
=
2
;
//
// panRow
//
this
.
panRow
.
AutoScroll
=
true
;
this
.
panRow
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panRow
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
40
);
this
.
panRow
.
Name
=
"panRow"
;
this
.
panRow
.
Size
=
new
System
.
Drawing
.
Size
(
317
,
225
);
this
.
panRow
.
TabIndex
=
1
;
this
.
panRow
.
Scroll
+=
new
System
.
Windows
.
Forms
.
ScrollEventHandler
(
this
.
panRow_Scroll
);
//
// ucSplitLine_H1
//
this
.
ucSplitLine_H1
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
232
)))),
((
int
)(((
byte
)(
232
)))),
((
int
)(((
byte
)(
232
)))));
...
...
@@ -97,24 +107,17 @@ namespace HZH_Controls.Controls
this
.
ucSplitLine_H1
.
TabIndex
=
0
;
this
.
ucSplitLine_H1
.
TabStop
=
false
;
//
// panRow
//
this
.
panRow
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
40
);
this
.
panRow
.
Name
=
"panRow"
;
this
.
panRow
.
Size
=
new
System
.
Drawing
.
Size
(
1061
,
525
);
this
.
panRow
.
TabIndex
=
1
;
//
// UCDataGridView
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
Controls
.
Add
(
this
.
panHead
);
this
.
Controls
.
Add
(
this
.
panRow
);
this
.
Controls
.
Add
(
this
.
panHead
);
this
.
Name
=
"UCDataGridView"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
1061
,
565
);
this
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
0
,
40
,
0
,
0
);
this
.
Size
=
new
System
.
Drawing
.
Size
(
317
,
265
);
this
.
Scroll
+=
new
System
.
Windows
.
Forms
.
ScrollEventHandler
(
this
.
UCDataGridView_Scroll
);
this
.
SizeChanged
+=
new
System
.
EventHandler
(
this
.
UCDataGridView_SizeChanged
);
this
.
Paint
+=
new
System
.
Windows
.
Forms
.
PaintEventHandler
(
this
.
UCDataGridView_Paint
);
this
.
panHead
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
...
...
@@ -135,13 +138,10 @@ namespace HZH_Controls.Controls
/// </summary>
private
UCSplitLine_H
ucSplitLine_H1
;
/// <summary>
/// The pan row
/// </summary>
private
System
.
Windows
.
Forms
.
Panel
panRow
;
/// <summary>
/// The pan head left
/// </summary>
private
System
.
Windows
.
Forms
.
Panel
panHeadLeft
;
private
System
.
Windows
.
Forms
.
FlowLayoutPanel
panRow
;
}
}
HZH_Controls/HZH_Controls/Controls/DataGridView/UCDataGridView.cs
查看文件 @
57a8ef8
...
...
@@ -348,7 +348,21 @@ namespace HZH_Controls.Controls
}
return
null
;
}
[
Bindable
(
false
)]
[
Browsable
(
false
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
[
EditorBrowsable
(
EditorBrowsableState
.
Never
)]
public
override
bool
AutoScroll
{
get
{
return
base
.
AutoScroll
;
}
set
{
base
.
AutoScroll
=
value
;
}
}
#
region
事件
/// <summary>
/// The head CheckBox change event
...
...
@@ -380,6 +394,7 @@ namespace HZH_Controls.Controls
#
endregion
#
endregion
/// <summary>
/// Initializes a new instance of the <see cref="UCDataGridView" /> class.
/// </summary>
...
...
@@ -428,19 +443,19 @@ namespace HZH_Controls.Controls
_width
+=
30
;
if
(
_width
>
this
.
Width
)
{
this
.
panRow
.
Width
=
_width
;
//
this.panRow.Width = _width;
this
.
panHead
.
Width
=
_width
;
}
else
{
if
(
m_columns
.
Any
(
p
=>
p
.
WidthType
==
SizeType
.
AutoSize
))
{
this
.
panRow
.
Width
=
this
.
Width
;
//
this.panRow.Width = this.Width;
this
.
panHead
.
Width
=
this
.
Width
;
}
else
{
this
.
panRow
.
Width
=
_width
;
//
this.panRow.Width = _width;
this
.
panHead
.
Width
=
_width
;
}
}
...
...
@@ -507,7 +522,7 @@ namespace HZH_Controls.Controls
#
endregion
#
region
公共函数
/// <summary>
...
...
@@ -560,6 +575,7 @@ namespace HZH_Controls.Controls
if
(
row
.
RowHeight
!=
m_rowHeight
)
row
.
RowHeight
=
m_rowHeight
;
item
.
Visible
=
true
;
item
.
Width
=
panHead
.
Width
;
item
.
BringToFront
();
Rows
.
Add
(
row
);
...
...
@@ -588,6 +604,7 @@ namespace HZH_Controls.Controls
row
.
BindingCellData
();
Control
rowControl
=
(
row
as
Control
);
rowControl
.
Width
=
panHead
.
Width
;
row
.
RowHeight
=
m_rowHeight
;
rowControl
.
Dock
=
DockStyle
.
Top
;
row
.
CellClick
+=
(
a
,
b
)
=>
{
SetSelectRow
(
rowControl
,
b
);
};
...
...
@@ -602,7 +619,7 @@ namespace HZH_Controls.Controls
}
}
this
.
panRow
.
Height
=
intSourceCount
*
RowHeight
;
//
this.panRow.Height = intSourceCount * RowHeight;
}
else
{
...
...
@@ -772,15 +789,20 @@ namespace HZH_Controls.Controls
private
void
UCDataGridView_Scroll
(
object
sender
,
ScrollEventArgs
e
)
{
if
(
e
.
ScrollOrientation
==
ScrollOrientation
.
VerticalScroll
)
{
panHead
.
Location
=
new
Point
(
0
,
this
.
VerticalScroll
.
Value
+
this
.
panRow
.
Location
.
Y
-
panHead
.
Height
-
2
);
}
//
if (e.ScrollOrientation == ScrollOrientation.VerticalScroll)
//
{
//
panHead.Location = new Point(0, this.VerticalScroll.Value + this.panRow.Location.Y - panHead.Height - 2);
//
}
}
private
void
UCDataGridView_Paint
(
object
sender
,
Paint
EventArgs
e
)
private
void
panRow_Scroll
(
object
sender
,
Scroll
EventArgs
e
)
{
}
if
(
e
.
ScrollOrientation
==
ScrollOrientation
.
HorizontalScroll
&&
this
.
panRow
.
Controls
.
Count
>
0
)
{
Console
.
WriteLine
(
this
.
panRow
.
HorizontalScroll
.
Value
);
Console
.
WriteLine
(
this
.
panRow
.
Controls
[
0
].
Location
.
X
);
panHead
.
Location
=
new
Point
(
this
.
panRow
.
HorizontalScroll
.
Value
*-
1
,
0
);
}
}
}
}
HZH_Controls/HZH_Controls/HZH_Controls.nuspec
查看文件 @
57a8ef8
...
...
@@ -2,7 +2,7 @@
<package
>
<metadata>
<id>
$id$
</id>
<version>
1.0.1
1
</version>
<version>
1.0.1
2
</version>
<title>
HZHControls
</title>
<authors>
HuangZhengHui
</authors>
<owners>
HuangZhengHui
</owners>
...
...
HZH_Controls/Test/UC/UCTestGridTable.Designer.cs
查看文件 @
57a8ef8
...
...
@@ -33,7 +33,6 @@
//
// ucDataGridView1
//
this
.
ucDataGridView1
.
AutoScroll
=
true
;
this
.
ucDataGridView1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucDataGridView1
.
Columns
=
null
;
this
.
ucDataGridView1
.
DataSource
=
null
;
...
...
@@ -46,9 +45,10 @@
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
(
7
39
,
599
);
this
.
ucDataGridView1
.
Size
=
new
System
.
Drawing
.
Size
(
7
24
,
510
);
this
.
ucDataGridView1
.
TabIndex
=
4
;
//
// UCTestGridTable
...
...
@@ -57,7 +57,7 @@
this
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
Controls
.
Add
(
this
.
ucDataGridView1
);
this
.
Name
=
"UCTestGridTable"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
7
39
,
599
);
this
.
Size
=
new
System
.
Drawing
.
Size
(
7
24
,
510
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
UCTestGridTable_Load
);
this
.
ResumeLayout
(
false
);
...
...
HZH_Controls/Test/UC/UCTestGridTable.cs
查看文件 @
57a8ef8
...
...
@@ -23,9 +23,9 @@ namespace Test.UC
{
List
<
DataGridViewColumnEntity
>
lstCulumns
=
new
List
<
DataGridViewColumnEntity
>();
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"ID"
,
HeadText
=
"编号"
,
Width
=
70
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Name"
,
HeadText
=
"姓名"
,
Width
=
1
00
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Name"
,
HeadText
=
"姓名"
,
Width
=
5
00
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Age"
,
HeadText
=
"年龄"
,
Width
=
500
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Birthday"
,
HeadText
=
"生日"
,
Width
=
15
0
,
WidthType
=
SizeType
.
Absolute
,
Format
=
(
a
)
=>
{
return
((
DateTime
)
a
).
ToString
(
"yyyy-MM-dd"
);
}
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Birthday"
,
HeadText
=
"生日"
,
Width
=
50
0
,
WidthType
=
SizeType
.
Absolute
,
Format
=
(
a
)
=>
{
return
((
DateTime
)
a
).
ToString
(
"yyyy-MM-dd"
);
}
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Sex"
,
HeadText
=
"性别"
,
Width
=
50
,
WidthType
=
SizeType
.
Absolute
,
Format
=
(
a
)
=>
{
return
((
int
)
a
)
==
0
?
"女"
:
"男"
;
}
});
this
.
ucDataGridView1
.
Columns
=
lstCulumns
;
this
.
ucDataGridView1
.
IsShowCheckBox
=
true
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论