Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 970640e7
由
HZH
编写于
2019-09-06 17:48:33 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
add 池子
1 个父辈
db2b4e71
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
213 行增加
和
20 行删除
HZH_Controls/HZH_Controls/Controls/FactoryControls/Pond/UCPond.cs
HZH_Controls/HZH_Controls/HZH_Controls.csproj
HZH_Controls/Test/Form4.Designer.cs
HZH_Controls/Test/Test.csproj
HZH_Controls/HZH_Controls/Controls/FactoryControls/Pond/UCPond.cs
0 → 100644
查看文件 @
970640e
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-06
//
// ***********************************************************************
// <copyright file="UCPond.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
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.ComponentModel
;
namespace
HZH_Controls.Controls
{
/// <summary>
/// Class UCPond.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public
class
UCPond
:
UserControl
{
/// <summary>
/// The maximum value
/// </summary>
private
decimal
maxValue
=
100
;
/// <summary>
/// Gets or sets the maximum value.
/// </summary>
/// <value>The maximum value.</value>
[
Description
(
"最大值"
),
Category
(
"自定义"
)]
public
decimal
MaxValue
{
get
{
return
maxValue
;
}
set
{
if
(
value
<
m_value
)
return
;
maxValue
=
value
;
Refresh
();
}
}
/// <summary>
/// The m value
/// </summary>
private
decimal
m_value
=
0
;
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
[
Description
(
"值"
),
Category
(
"自定义"
)]
public
decimal
Value
{
get
{
return
m_value
;
}
set
{
if
(
value
<
0
)
return
;
if
(
value
>
maxValue
)
m_value
=
maxValue
;
else
m_value
=
value
;
Refresh
();
}
}
/// <summary>
/// The wall color
/// </summary>
private
Color
wallColor
=
Color
.
FromArgb
(
255
,
77
,
59
);
/// <summary>
/// Gets or sets the color of the wall.
/// </summary>
/// <value>The color of the wall.</value>
[
Description
(
"池壁颜色"
),
Category
(
"自定义"
)]
public
Color
WallColor
{
get
{
return
wallColor
;
}
set
{
wallColor
=
value
;
Refresh
();
}
}
/// <summary>
/// The wall width
/// </summary>
private
int
wallWidth
=
2
;
/// <summary>
/// Gets or sets the width of the wall.
/// </summary>
/// <value>The width of the wall.</value>
[
Description
(
"池壁宽度"
),
Category
(
"自定义"
)]
public
int
WallWidth
{
get
{
return
wallWidth
;
}
set
{
if
(
value
<=
0
)
return
;
wallWidth
=
value
;
Refresh
();
}
}
/// <summary>
/// The liquid color
/// </summary>
private
Color
liquidColor
=
Color
.
FromArgb
(
3
,
169
,
243
);
/// <summary>
/// Initializes a new instance of the <see cref="UCPond"/> class.
/// </summary>
public
UCPond
()
{
this
.
SetStyle
(
ControlStyles
.
AllPaintingInWmPaint
,
true
);
this
.
SetStyle
(
ControlStyles
.
DoubleBuffer
,
true
);
this
.
SetStyle
(
ControlStyles
.
ResizeRedraw
,
true
);
this
.
SetStyle
(
ControlStyles
.
Selectable
,
true
);
this
.
SetStyle
(
ControlStyles
.
SupportsTransparentBackColor
,
true
);
this
.
SetStyle
(
ControlStyles
.
UserPaint
,
true
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Size
=
new
Size
(
150
,
50
);
}
/// <summary>
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
/// </summary>
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
protected
override
void
OnPaint
(
PaintEventArgs
e
)
{
base
.
OnPaint
(
e
);
if
(
Height
<=
0
)
return
;
var
g
=
e
.
Graphics
;
g
.
SetGDIHigh
();
int
intHeight
=
(
int
)(
m_value
/
maxValue
*
this
.
Height
);
if
(
intHeight
!=
0
)
{
g
.
FillRectangle
(
new
SolidBrush
(
liquidColor
),
new
Rectangle
(
0
,
this
.
Height
-
intHeight
,
this
.
Width
,
intHeight
));
}
//划边
g
.
FillRectangle
(
new
SolidBrush
(
wallColor
),
0
,
0
,
wallWidth
,
this
.
Height
);
g
.
FillRectangle
(
new
SolidBrush
(
wallColor
),
0
,
this
.
Height
-
wallWidth
,
this
.
Width
,
wallWidth
);
g
.
FillRectangle
(
new
SolidBrush
(
wallColor
),
this
.
Width
-
wallWidth
-
1
,
0
,
wallWidth
,
this
.
Height
);
}
}
}
HZH_Controls/HZH_Controls/HZH_Controls.csproj
查看文件 @
970640e
...
...
@@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
...
...
@@ -99,6 +100,9 @@
<Compile Include="Controls\FactoryControls\Conveyor\UCConveyor.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\FactoryControls\Pond\UCPond.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\FactoryControls\Valve\UCValve.cs">
<SubType>UserControl</SubType>
</Compile>
...
...
HZH_Controls/Test/Form4.Designer.cs
查看文件 @
970640e
...
...
@@ -28,6 +28,7 @@
/// </summary>
private
void
InitializeComponent
()
{
this
.
ucValve4
=
new
HZH_Controls
.
Controls
.
UCValve
();
this
.
ucValve1
=
new
HZH_Controls
.
Controls
.
UCValve
();
this
.
ucValve2
=
new
HZH_Controls
.
Controls
.
UCValve
();
this
.
ucValve3
=
new
HZH_Controls
.
Controls
.
UCValve
();
...
...
@@ -67,11 +68,28 @@
this
.
ucConduit10
=
new
HZH_Controls
.
Controls
.
Conduit
.
UCConduit
();
this
.
ucConduit1
=
new
HZH_Controls
.
Controls
.
Conduit
.
UCConduit
();
this
.
ucBottle1
=
new
HZH_Controls
.
Controls
.
UCBottle
();
this
.
uc
Valve4
=
new
HZH_Controls
.
Controls
.
UCValve
();
this
.
uc
Pond1
=
new
HZH_Controls
.
Controls
.
UCPond
();
this
.
SuspendLayout
();
//
// ucValve4
//
this
.
ucValve4
.
AsisBottomColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve4
.
AxisColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve4
.
LiquidColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve4
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
Backward
;
this
.
ucValve4
.
LiquidSpeed
=
100
;
this
.
ucValve4
.
Location
=
new
System
.
Drawing
.
Point
(
1079
,
52
);
this
.
ucValve4
.
Name
=
"ucValve4"
;
this
.
ucValve4
.
Opened
=
true
;
this
.
ucValve4
.
Size
=
new
System
.
Drawing
.
Size
(
169
,
106
);
this
.
ucValve4
.
SwitchColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
232
)))),
((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
99
)))));
this
.
ucValve4
.
TabIndex
=
22
;
this
.
ucValve4
.
ValveColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
77
)))),
((
int
)(((
byte
)(
59
)))));
this
.
ucValve4
.
ValveStyle
=
HZH_Controls
.
Controls
.
ValveStyle
.
Horizontal_Bottom
;
//
// ucValve1
//
this
.
ucValve1
.
AsisBottomColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve1
.
AxisColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve1
.
LiquidColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve1
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
Backward
;
...
...
@@ -87,11 +105,12 @@
//
// ucValve2
//
this
.
ucValve2
.
AsisBottomColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve2
.
AxisColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve2
.
LiquidColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve2
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
Back
ward
;
this
.
ucValve2
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
For
ward
;
this
.
ucValve2
.
LiquidSpeed
=
100
;
this
.
ucValve2
.
Location
=
new
System
.
Drawing
.
Point
(
1222
,
307
);
this
.
ucValve2
.
Location
=
new
System
.
Drawing
.
Point
(
1222
,
279
);
this
.
ucValve2
.
Name
=
"ucValve2"
;
this
.
ucValve2
.
Opened
=
true
;
this
.
ucValve2
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
131
);
...
...
@@ -102,11 +121,12 @@
//
// ucValve3
//
this
.
ucValve3
.
AsisBottomColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve3
.
AxisColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve3
.
LiquidColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve3
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
Back
ward
;
this
.
ucValve3
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
For
ward
;
this
.
ucValve3
.
LiquidSpeed
=
100
;
this
.
ucValve3
.
Location
=
new
System
.
Drawing
.
Point
(
1259
,
1
76
);
this
.
ucValve3
.
Location
=
new
System
.
Drawing
.
Point
(
1259
,
1
48
);
this
.
ucValve3
.
Name
=
"ucValve3"
;
this
.
ucValve3
.
Opened
=
true
;
this
.
ucValve3
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
131
);
...
...
@@ -592,29 +612,34 @@
0
,
0
});
//
// uc
Valve4
// uc
Pond1
//
this
.
ucValve4
.
AxisColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve4
.
LiquidColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
3
)))),
((
int
)(((
byte
)(
169
)))),
((
int
)(((
byte
)(
243
)))));
this
.
ucValve4
.
LiquidDirection
=
HZH_Controls
.
Controls
.
Conduit
.
LiquidDirection
.
Backward
;
this
.
ucValve4
.
LiquidSpeed
=
100
;
this
.
ucValve4
.
Location
=
new
System
.
Drawing
.
Point
(
1079
,
52
);
this
.
ucValve4
.
Name
=
"ucValve4"
;
this
.
ucValve4
.
Opened
=
true
;
this
.
ucValve4
.
Size
=
new
System
.
Drawing
.
Size
(
169
,
106
);
this
.
ucValve4
.
SwitchColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
232
)))),
((
int
)(((
byte
)(
30
)))),
((
int
)(((
byte
)(
99
)))));
this
.
ucValve4
.
TabIndex
=
22
;
this
.
ucValve4
.
ValveColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
77
)))),
((
int
)(((
byte
)(
59
)))));
this
.
ucValve4
.
ValveStyle
=
HZH_Controls
.
Controls
.
ValveStyle
.
Horizontal_Bottom
;
this
.
ucPond1
.
Location
=
new
System
.
Drawing
.
Point
(
1206
,
384
);
this
.
ucPond1
.
MaxValue
=
new
decimal
(
new
int
[]
{
100
,
0
,
0
,
0
});
this
.
ucPond1
.
Name
=
"ucPond1"
;
this
.
ucPond1
.
Size
=
new
System
.
Drawing
.
Size
(
150
,
71
);
this
.
ucPond1
.
TabIndex
=
23
;
this
.
ucPond1
.
Value
=
new
decimal
(
new
int
[]
{
50
,
0
,
0
,
0
});
this
.
ucPond1
.
WallColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
77
)))),
((
int
)(((
byte
)(
59
)))));
this
.
ucPond1
.
WallWidth
=
2
;
//
// Form4
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1368
,
680
);
this
.
Controls
.
Add
(
this
.
ucValve2
);
this
.
Controls
.
Add
(
this
.
ucPond1
);
this
.
Controls
.
Add
(
this
.
ucValve4
);
this
.
Controls
.
Add
(
this
.
ucValve1
);
this
.
Controls
.
Add
(
this
.
ucValve2
);
this
.
Controls
.
Add
(
this
.
ucValve3
);
this
.
Controls
.
Add
(
this
.
ucConveyor2
);
this
.
Controls
.
Add
(
this
.
ucConveyor6
);
...
...
@@ -700,5 +725,6 @@
private
HZH_Controls
.
Controls
.
UCValve
ucValve1
;
private
HZH_Controls
.
Controls
.
UCValve
ucValve2
;
private
HZH_Controls
.
Controls
.
UCValve
ucValve4
;
private
HZH_Controls
.
Controls
.
UCPond
ucPond1
;
}
}
\ No newline at end of file
HZH_Controls/Test/Test.csproj
查看文件 @
970640e
...
...
@@ -13,7 +13,7 @@
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
x86
</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论