Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7707ae4c
由
HZH
编写于
2019-09-28 09:32:41 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
验证
1 个父辈
635c46c4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
444 行增加
和
23 行删除
HZH_Controls/HZH_Controls/Controls/GraphicalOverlay/GraphicalOverlay.cs
HZH_Controls/HZH_Controls/Controls/Text/TextBoxEx.cs
HZH_Controls/HZH_Controls/Controls/Verification/VerificationAttribute.cs
HZH_Controls/HZH_Controls/Controls/Verification/VerificationComponent.cs
HZH_Controls/HZH_Controls/Controls/Verification/VerificationEventArgs.cs
HZH_Controls/HZH_Controls/Controls/Verification/VerificationModel.cs
HZH_Controls/HZH_Controls/Forms/FrmAnchorTips.cs
HZH_Controls/HZH_Controls/Forms/FrmInputs.cs
HZH_Controls/HZH_Controls/HZH_Controls.csproj
HZH_Controls/HZH_Controls/Helpers/ControlHelper.cs
HZH_Controls/Test/FrmMain.cs
HZH_Controls/Test/Test.csproj
HZH_Controls/Test/UC/UCTestGraphicalOverlay.cs
HZH_Controls/Test/UC/UCTestVerification.Designer.cs
HZH_Controls/Test/UC/UCTestVerification.cs
HZH_Controls/Test/UC/UCTestVerification.resx
HZH_Controls/HZH_Controls/Controls/GraphicalOverlay/GraphicalOverlay.cs
查看文件 @
7707ae4
...
@@ -21,7 +21,8 @@ namespace HZH_Controls.Controls
...
@@ -21,7 +21,8 @@ namespace HZH_Controls.Controls
InitializeComponent
();
InitializeComponent
();
}
}
private
Control
owner
;
private
Control
owner
;
[
Browsable
(
true
),
Category
(
"自定义属性"
),
Description
(
"父控件"
),
Localizable
(
true
)]
public
Control
Owner
public
Control
Owner
{
{
get
{
return
owner
;
}
get
{
return
owner
;
}
...
@@ -29,11 +30,11 @@ namespace HZH_Controls.Controls
...
@@ -29,11 +30,11 @@ namespace HZH_Controls.Controls
{
{
// The owner form cannot be set to null.
// The owner form cannot be set to null.
if
(
value
==
null
)
if
(
value
==
null
)
throw
new
ArgumentNullException
()
;
return
;
// The owner form can only be set once.
// The owner form can only be set once.
if
(
owner
!=
null
)
if
(
owner
!=
null
)
throw
new
InvalidOperationException
()
;
return
;
// Save the form for future reference.
// Save the form for future reference.
owner
=
value
;
owner
=
value
;
...
...
HZH_Controls/HZH_Controls/Controls/Text/TextBoxEx.cs
查看文件 @
7707ae4
...
@@ -369,14 +369,15 @@ namespace HZH_Controls.Controls
...
@@ -369,14 +369,15 @@ namespace HZH_Controls.Controls
/// 处理 Windows 消息。
/// 处理 Windows 消息。
/// </summary>
/// </summary>
/// <param name="m">一个 Windows 消息对象。</param>
/// <param name="m">一个 Windows 消息对象。</param>
protected
override
void
WndProc
(
ref
Message
m
)
//protected override void WndProc(ref Message m)
{
//{
base
.
WndProc
(
ref
m
);
// base.WndProc(ref m);
if
(
m
.
Msg
==
15
||
m
.
Msg
==
7
||
m
.
Msg
==
8
)
// if (m.Msg == 15 || m.Msg == 7 || m.Msg == 8)
{
// {
this
.
OnPaint
(
null
);
// //this.OnPaint(null);
}
// Invalidate();
}
// }
//}
/// <summary>
/// <summary>
/// Handles the <see cref="E:TextChanged" /> event.
/// Handles the <see cref="E:TextChanged" /> event.
...
...
HZH_Controls/HZH_Controls/Controls/Verification/VerificationAttribute.cs
0 → 100644
查看文件 @
7707ae4
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
HZH_Controls.Controls
{
public
class
VerificationAttribute
:
Attribute
{
public
VerificationAttribute
(
string
strRegex
=
""
,
string
strErrorMsg
=
""
)
{
Regex
=
strRegex
;
ErrorMsg
=
strErrorMsg
;
}
public
string
Regex
{
get
;
set
;
}
public
string
ErrorMsg
{
get
;
set
;
}
}
}
HZH_Controls/HZH_Controls/Controls/Verification/VerificationComponent.cs
0 → 100644
查看文件 @
7707ae4
此文件的差异被折叠,
点击展开。
HZH_Controls/HZH_Controls/Controls/Verification/VerificationEventArgs.cs
0 → 100644
查看文件 @
7707ae4
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-27
//
// ***********************************************************************
// <copyright file="VerificationEventArgs.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
namespace
HZH_Controls.Controls
{
/// <summary>
/// Class VerificationEventArgs.
/// Implements the <see cref="System.EventArgs" />
/// </summary>
/// <seealso cref="System.EventArgs" />
public
class
VerificationEventArgs
:
EventArgs
{
/// <summary>
/// Gets or sets the verification control.
/// </summary>
/// <value>The verification control.</value>
public
Control
VerificationControl
{
get
;
set
;
}
/// <summary>
/// Gets or sets a value indicating whether [verify success].
/// </summary>
/// <value><c>true</c> if [verify success]; otherwise, <c>false</c>.</value>
public
bool
IsVerifySuccess
{
get
;
set
;
}
/// <summary>
/// Gets or sets the verification model.
/// </summary>
/// <value>The verification model.</value>
public
VerificationModel
VerificationModel
{
get
;
set
;
}
/// <summary>
/// 是否已处理,如果为true,则不再使用默认验证提示功能
/// </summary>
/// <value><c>true</c> if this instance is processed; otherwise, <c>false</c>.</value>
public
bool
IsProcessed
{
get
;
set
;
}
/// <summary>
/// Gets or sets 正则表达式
/// </summary>
/// <value>The custom regex.</value>
public
string
Regex
{
get
;
set
;
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="VerificationEventArgs"/> is required.
/// </summary>
/// <value><c>true</c> if required; otherwise, <c>false</c>.</value>
public
bool
Required
{
get
;
set
;
}
/// <summary>
/// Gets or sets the error MSG.
/// </summary>
/// <value>The error MSG.</value>
public
string
ErrorMsg
{
get
;
set
;
}
}
}
HZH_Controls/HZH_Controls/Controls/Verification/VerificationModel.cs
0 → 100644
查看文件 @
7707ae4
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
namespace
HZH_Controls.Controls
{
/// <summary>
/// 验证规则
/// </summary>
public
enum
VerificationModel
{
/// <summary>
/// 无
/// </summary>
[
Description
(
"无"
),
VerificationAttribute
()]
None
=
1
,
/// <summary>
/// 任意字母数字下划线
/// </summary>
[
Description
(
"任意字母数字下划线"
),
VerificationAttribute
(
@"^[a-zA-Z_0-1]*$"
,
"请输入任意字母数字下划线"
)]
AnyChar
=
2
,
/// <summary>
/// 任意数字
/// </summary>
[
Description
(
"任意数字"
),
VerificationAttribute
(
@"^[\-\+]?\d+(\.\d+)?$"
,
"请输入任意数字"
)]
Number
=
4
,
/// <summary>
/// 非负数
/// </summary>
[
Description
(
"非负数"
),
VerificationAttribute
(
@"^(\+)?\d+(\.\d+)?$"
,
"请输入非负数"
)]
UnsignNumber
=
8
,
/// <summary>
/// 正数
/// </summary>
[
Description
(
"正数"
),
VerificationAttribute
(
@"(\+)?([1-9][0-9]*(\.\d{1,2})?)|(0\.\d{1,2})"
,
"请输入正数"
)]
PositiveNumber
=
16
,
/// <summary>
/// 整数
/// </summary>
[
Description
(
"整数"
),
VerificationAttribute
(
@"^[\+\-]?\d+$"
,
"请输入整数"
)]
Integer
=
32
,
/// <summary>
/// 非负整数
/// </summary>
[
Description
(
"非负整数"
),
VerificationAttribute
(
@"^(\+)?\d+$"
,
"请输入非负整数"
)]
UnsignIntegerNumber
=
64
,
/// <summary>
/// 正整数
/// </summary>
[
Description
(
"正整数"
),
VerificationAttribute
(
@"^[0-9]*[1-9][0-9]*$"
,
"请输入正整数"
)]
PositiveIntegerNumber
=
128
,
/// <summary>
/// 邮箱
/// </summary>
[
Description
(
"邮箱"
),
VerificationAttribute
(
@"^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$"
,
"请输入正确的邮箱地址"
)]
Email
=
256
,
/// <summary>
/// 手机
/// </summary>
[
Description
(
"手机"
),
VerificationAttribute
(
@"^(\+?86)?1\d{10}$"
,
"请输入正确的手机号"
)]
Phone
=
512
,
/// <summary>
/// IP
/// </summary>
[
Description
(
"IP"
),
VerificationAttribute
(
@"(?=(\b|\D))(((\d{1,2})|(1\d{1,2})|(2[0-4]\d)|(25[0-5]))\.){3}((\d{1,2})|(1\d{1,2})|(2[0-4]\d)|(25[0-5]))(?=(\b|\D))"
,
"请输入正确的IP地址"
)]
IP
=
1024
,
/// <summary>
/// Url
/// </summary>
[
Description
(
"Url"
),
VerificationAttribute
(
@"^[a-zA-z]+://(//w+(-//w+)*)(//.(//w+(-//w+)*))*(//?//S*)?$"
,
"请输入正确的网址"
)]
URL
=
2048
,
/// <summary>
/// 身份证号
/// </summary>
[
Description
(
"身份证号"
),
VerificationAttribute
(
@"^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$"
,
"请输入正确的身份证号"
)]
IDCardNo
=
4096
,
/// <summary>
/// 正则验证
/// </summary>
[
Description
(
"自定义正则表达式"
),
VerificationAttribute
()]
Custom
=
8192
,
}
}
HZH_Controls/HZH_Controls/Forms/FrmAnchorTips.cs
查看文件 @
7707ae4
...
@@ -140,11 +140,11 @@ namespace HZH_Controls.Forms
...
@@ -140,11 +140,11 @@ namespace HZH_Controls.Forms
Color
_foreColor
=
m_foreColor
==
null
?
Color
.
White
:
m_foreColor
.
Value
;
Color
_foreColor
=
m_foreColor
==
null
?
Color
.
White
:
m_foreColor
.
Value
;
System
.
Drawing
.
SizeF
sizeText
=
g
.
MeasureString
(
strMsg
,
_font
);
System
.
Drawing
.
SizeF
sizeText
=
g
.
MeasureString
(
strMsg
,
_font
);
g
.
Dispose
();
g
.
Dispose
();
var
formSize
=
new
Size
((
int
)
sizeText
.
Width
+
20
,
(
int
)
sizeText
.
Height
+
2
0
);
var
formSize
=
new
Size
((
int
)
sizeText
.
Width
+
10
,
(
int
)
sizeText
.
Height
+
1
0
);
if
(
formSize
.
Width
<
2
0
)
if
(
formSize
.
Width
<
1
0
)
formSize
.
Width
=
2
0
;
formSize
.
Width
=
1
0
;
if
(
formSize
.
Height
<
2
0
)
if
(
formSize
.
Height
<
1
0
)
formSize
.
Height
=
2
0
;
formSize
.
Height
=
1
0
;
if
(
m_location
==
AnchorTipsLocation
.
LEFT
||
m_location
==
AnchorTipsLocation
.
RIGHT
)
if
(
m_location
==
AnchorTipsLocation
.
LEFT
||
m_location
==
AnchorTipsLocation
.
RIGHT
)
{
{
formSize
.
Width
+=
20
;
formSize
.
Width
+=
20
;
...
@@ -244,7 +244,7 @@ namespace HZH_Controls.Forms
...
@@ -244,7 +244,7 @@ namespace HZH_Controls.Forms
Graphics
gBit
=
Graphics
.
FromImage
(
bit
);
Graphics
gBit
=
Graphics
.
FromImage
(
bit
);
gBit
.
SetGDIHigh
();
gBit
.
SetGDIHigh
();
gBit
.
FillPath
(
new
SolidBrush
(
_background
),
path
);
gBit
.
FillPath
(
new
SolidBrush
(
_background
),
path
);
gBit
.
DrawString
(
strMsg
,
_font
,
new
SolidBrush
(
_foreColor
),
rect
.
Location
+
new
Size
(
10
,
10
)
);
gBit
.
DrawString
(
strMsg
,
_font
,
new
SolidBrush
(
_foreColor
),
rect
,
new
StringFormat
()
{
Alignment
=
StringAlignment
.
Center
,
LineAlignment
=
StringAlignment
.
Center
}
);
gBit
.
Dispose
();
gBit
.
Dispose
();
#
endregion
#
endregion
...
@@ -264,6 +264,7 @@ namespace HZH_Controls.Forms
...
@@ -264,6 +264,7 @@ namespace HZH_Controls.Forms
/// <param name="deviation">The deviation.</param>
/// <param name="deviation">The deviation.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="blnTopMost">是否置顶</param>
/// <returns>FrmAnchorTips.</returns>
/// <returns>FrmAnchorTips.</returns>
public
static
FrmAnchorTips
ShowTips
(
public
static
FrmAnchorTips
ShowTips
(
Control
parentControl
,
Control
parentControl
,
...
@@ -273,7 +274,8 @@ namespace HZH_Controls.Forms
...
@@ -273,7 +274,8 @@ namespace HZH_Controls.Forms
Color
?
foreColor
=
null
,
Color
?
foreColor
=
null
,
Size
?
deviation
=
null
,
Size
?
deviation
=
null
,
int
fontSize
=
10
,
int
fontSize
=
10
,
int
autoCloseTime
=
5000
)
int
autoCloseTime
=
5000
,
bool
blnTopMost
=
true
)
{
{
Point
p
;
Point
p
;
if
(
parentControl
is
Form
)
if
(
parentControl
is
Form
)
...
@@ -288,7 +290,7 @@ namespace HZH_Controls.Forms
...
@@ -288,7 +290,7 @@ namespace HZH_Controls.Forms
{
{
p
=
p
+
deviation
.
Value
;
p
=
p
+
deviation
.
Value
;
}
}
return
ShowTips
(
new
Rectangle
(
p
,
parentControl
.
Size
),
strMsg
,
location
,
background
,
foreColor
,
fontSize
,
autoCloseTime
);
return
ShowTips
(
new
Rectangle
(
p
,
parentControl
.
Size
),
strMsg
,
location
,
background
,
foreColor
,
fontSize
,
autoCloseTime
,
parentControl
.
FindForm
(),
blnTopMost
);
}
}
#
endregion
#
endregion
...
@@ -303,6 +305,8 @@ namespace HZH_Controls.Forms
...
@@ -303,6 +305,8 @@ namespace HZH_Controls.Forms
/// <param name="foreColor">Color of the fore.</param>
/// <param name="foreColor">Color of the fore.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="parentForm">父窗体</param>
/// <param name="blnTopMost">是否置顶</param>
/// <returns>FrmAnchorTips.</returns>
/// <returns>FrmAnchorTips.</returns>
public
static
FrmAnchorTips
ShowTips
(
public
static
FrmAnchorTips
ShowTips
(
Rectangle
rectControl
,
Rectangle
rectControl
,
...
@@ -311,11 +315,13 @@ namespace HZH_Controls.Forms
...
@@ -311,11 +315,13 @@ namespace HZH_Controls.Forms
Color
?
background
=
null
,
Color
?
background
=
null
,
Color
?
foreColor
=
null
,
Color
?
foreColor
=
null
,
int
fontSize
=
10
,
int
fontSize
=
10
,
int
autoCloseTime
=
5000
)
int
autoCloseTime
=
5000
,
Form
parentForm
=
null
,
bool
blnTopMost
=
true
)
{
{
FrmAnchorTips
frm
=
new
FrmAnchorTips
(
rectControl
,
strMsg
,
location
,
background
,
foreColor
,
fontSize
,
autoCloseTime
);
FrmAnchorTips
frm
=
new
FrmAnchorTips
(
rectControl
,
strMsg
,
location
,
background
,
foreColor
,
fontSize
,
autoCloseTime
);
frm
.
TopMost
=
true
;
frm
.
TopMost
=
blnTopMost
;
frm
.
Show
();
frm
.
Show
(
parentForm
);
return
frm
;
return
frm
;
}
}
#
endregion
#
endregion
...
...
HZH_Controls/HZH_Controls/Forms/FrmInputs.cs
查看文件 @
7707ae4
...
@@ -21,6 +21,7 @@ using System.Drawing;
...
@@ -21,6 +21,7 @@ using System.Drawing;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
HZH_Controls.Controls
;
namespace
HZH_Controls.Forms
namespace
HZH_Controls.Forms
{
{
...
...
HZH_Controls/HZH_Controls/HZH_Controls.csproj
查看文件 @
7707ae4
...
@@ -85,6 +85,12 @@
...
@@ -85,6 +85,12 @@
<Compile Include="Controls\ScrollBar\UCHScrollbar.cs">
<Compile Include="Controls\ScrollBar\UCHScrollbar.cs">
<SubType>UserControl</SubType>
<SubType>UserControl</SubType>
</Compile>
</Compile>
<Compile Include="Controls\Verification\VerificationAttribute.cs" />
<Compile Include="Controls\Verification\VerificationComponent.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\Verification\VerificationEventArgs.cs" />
<Compile Include="Controls\Verification\VerificationModel.cs" />
<Compile Include="Forms\FrmLoading.cs">
<Compile Include="Forms\FrmLoading.cs">
<SubType>Form</SubType>
<SubType>Form</SubType>
</Compile>
</Compile>
...
...
HZH_Controls/HZH_Controls/Helpers/ControlHelper.cs
查看文件 @
7707ae4
...
@@ -26,6 +26,7 @@ using System.Text;
...
@@ -26,6 +26,7 @@ using System.Text;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
System.Threading
;
using
System.Threading
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
HZH_Controls.Controls
;
namespace
HZH_Controls
namespace
HZH_Controls
{
{
...
...
HZH_Controls/Test/FrmMain.cs
查看文件 @
7707ae4
...
@@ -60,6 +60,7 @@ namespace Test
...
@@ -60,6 +60,7 @@ namespace Test
tnControl
.
Nodes
.
Add
(
"图标"
);
tnControl
.
Nodes
.
Add
(
"图标"
);
tnControl
.
Nodes
.
Add
(
"滚动条"
);
tnControl
.
Nodes
.
Add
(
"滚动条"
);
tnControl
.
Nodes
.
Add
(
"控件水印"
);
tnControl
.
Nodes
.
Add
(
"控件水印"
);
tnControl
.
Nodes
.
Add
(
"表单验证"
);
this
.
tvMenu
.
Nodes
.
Add
(
tnControl
);
this
.
tvMenu
.
Nodes
.
Add
(
tnControl
);
TreeNode
tnCharts
=
new
TreeNode
(
" 图表"
);
TreeNode
tnCharts
=
new
TreeNode
(
" 图表"
);
...
@@ -246,6 +247,9 @@ namespace Test
...
@@ -246,6 +247,9 @@ namespace Test
case
"控件水印"
:
case
"控件水印"
:
AddControl
(
new
UC
.
UCTestGraphicalOverlay
());
AddControl
(
new
UC
.
UCTestGraphicalOverlay
());
break
;
break
;
case
"表单验证"
:
AddControl
(
new
UC
.
UCTestVerification
()
{
Dock
=
DockStyle
.
Fill
});
break
;
#
endregion
#
endregion
#
region
图表
English
:
Chart
#
region
图表
English
:
Chart
...
...
HZH_Controls/Test/Test.csproj
查看文件 @
7707ae4
...
@@ -302,6 +302,12 @@
...
@@ -302,6 +302,12 @@
<Compile Include="UC\UCTestValve.Designer.cs">
<Compile Include="UC\UCTestValve.Designer.cs">
<DependentUpon>UCTestValve.cs</DependentUpon>
<DependentUpon>UCTestValve.cs</DependentUpon>
</Compile>
</Compile>
<Compile Include="UC\UCTestVerification.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC\UCTestVerification.Designer.cs">
<DependentUpon>UCTestVerification.cs</DependentUpon>
</Compile>
<Compile Include="UC\UCTestWave.cs">
<Compile Include="UC\UCTestWave.cs">
<SubType>UserControl</SubType>
<SubType>UserControl</SubType>
</Compile>
</Compile>
...
@@ -449,6 +455,9 @@
...
@@ -449,6 +455,9 @@
<EmbeddedResource Include="UC\UCTestValve.resx">
<EmbeddedResource Include="UC\UCTestValve.resx">
<DependentUpon>UCTestValve.cs</DependentUpon>
<DependentUpon>UCTestValve.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestVerification.resx">
<DependentUpon>UCTestVerification.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestWave.resx">
<EmbeddedResource Include="UC\UCTestWave.resx">
<DependentUpon>UCTestWave.cs</DependentUpon>
<DependentUpon>UCTestWave.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
...
...
HZH_Controls/Test/UC/UCTestGraphicalOverlay.cs
查看文件 @
7707ae4
...
@@ -21,9 +21,9 @@ namespace Test.UC
...
@@ -21,9 +21,9 @@ namespace Test.UC
private
void
graphicalOverlay1_Paint
(
object
sender
,
PaintEventArgs
e
)
private
void
graphicalOverlay1_Paint
(
object
sender
,
PaintEventArgs
e
)
{
{
e
.
Graphics
.
SetGDIHigh
();
if
(
blnColor
)
if
(
blnColor
)
{
{
e
.
Graphics
.
SetGDIHigh
();
foreach
(
Control
item
in
this
.
Controls
)
foreach
(
Control
item
in
this
.
Controls
)
{
{
if
(
item
is
Button
)
if
(
item
is
Button
)
...
...
HZH_Controls/Test/UC/UCTestVerification.Designer.cs
0 → 100644
查看文件 @
7707ae4
此文件的差异被折叠,
点击展开。
HZH_Controls/Test/UC/UCTestVerification.cs
0 → 100644
查看文件 @
7707ae4
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Drawing
;
using
System.Data
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
using
HZH_Controls.Controls
;
using
HZH_Controls
;
using
System.Drawing.Drawing2D
;
namespace
Test.UC
{
public
partial
class
UCTestVerification
:
UserControl
{
public
UCTestVerification
()
{
InitializeComponent
();
}
List
<
Control
>
lstErrorControl
=
new
List
<
Control
>();
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
lstErrorControl
.
Clear
();
this
.
verificationComponent1
.
Verification
();
this
.
panel1
.
Invalidate
(
true
);
}
private
void
UCTestVerification_Load
(
object
sender
,
EventArgs
e
)
{
List
<
KeyValuePair
<
string
,
string
>>
lstCom
=
new
List
<
KeyValuePair
<
string
,
string
>>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
lstCom
.
Add
(
new
KeyValuePair
<
string
,
string
>(
i
.
ToString
(),
"选项"
+
i
));
}
this
.
ucComboBox1
.
Source
=
lstCom
;
this
.
ucComboBox2
.
Source
=
lstCom
;
this
.
ucCombox2
.
Source
=
lstCom
;
this
.
ucCombox1
.
Source
=
lstCom
;
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
=
100
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Age"
,
HeadText
=
"年龄"
,
Width
=
100
,
WidthType
=
SizeType
.
Absolute
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Birthday"
,
HeadText
=
"生日"
,
Width
=
120
,
WidthType
=
SizeType
.
Absolute
,
Format
=
(
a
)
=>
{
return
((
DateTime
)
a
).
ToString
(
"yyyy-MM-dd"
);
}
});
lstCulumns
.
Add
(
new
DataGridViewColumnEntity
()
{
DataField
=
"Sex"
,
HeadText
=
"性别"
,
Width
=
100
,
WidthType
=
SizeType
.
Absolute
,
Format
=
(
a
)
=>
{
return
((
int
)
a
)
==
0
?
"女"
:
"男"
;
}
});
this
.
ucComboxGrid1
.
GridColumns
=
lstCulumns
;
List
<
object
>
lstSourceGrid
=
new
List
<
object
>();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
TestGridModel
model
=
new
TestGridModel
()
{
ID
=
i
.
ToString
(),
Age
=
3
*
i
,
Name
=
"姓名——"
+
i
,
Birthday
=
DateTime
.
Now
.
AddYears
(-
10
),
Sex
=
i
%
2
};
lstSourceGrid
.
Add
(
model
);
}
this
.
ucComboxGrid1
.
GridDataSource
=
lstSourceGrid
;
ucComboxGrid2
.
GridDataSource
=
lstSourceGrid
;
}
private
void
graphicalOverlay1_Paint
(
object
sender
,
PaintEventArgs
e
)
{
if
(
lstErrorControl
.
Count
>
0
)
{
e
.
Graphics
.
SetGDIHigh
();
foreach
(
Control
control
in
lstErrorControl
)
{
if
(
control
.
Parent
==
this
.
groupBox2
||
control
.
Parent
==
this
.
groupBox4
)
{
var
p
=
control
.
Location
;
p
.
Offset
(
control
.
Parent
.
Location
);
GraphicsPath
path
=
ControlHelper
.
CreateRoundedRectanglePath
(
new
Rectangle
(
p
.
X
-
1
,
p
.
Y
-
1
,
control
.
Width
+
2
,
control
.
Height
+
2
),
4
);
e
.
Graphics
.
DrawPath
(
new
Pen
(
new
SolidBrush
(
Color
.
FromArgb
(
100
,
255
,
0
,
0
)),
2
),
path
);
}
}
}
}
private
void
verificationComponent1_Verificationed
(
VerificationEventArgs
e
)
{
if
(!
e
.
IsVerifySuccess
)
{
lstErrorControl
.
Add
(
e
.
VerificationControl
);
}
}
}
}
HZH_Controls/Test/UC/UCTestVerification.resx
0 → 100644
查看文件 @
7707ae4
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="verificationComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="graphicalOverlay1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>212, 17</value>
</metadata>
</root>
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论