Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d4c50761
由
kwwwvagaa
编写于
2020-08-13 10:51:48 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加等待进度条
1 个父辈
db456457
全部展开
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
94 行增加
和
0 行删除
HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs
HZH_Controls/HZH_Controls/HZH_Controls.csproj
HZH_Controls/Test/UC/UCTestProcess.Designer.cs
HZH_Controls/HZH_Controls/Controls/Process/UCProcessRoll.cs
0 → 100644
查看文件 @
d4c5076
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
using
System.Drawing.Drawing2D
;
using
System.Drawing
;
using
System.ComponentModel
;
namespace
HZH_Controls.Controls
{
public
class
UCProcessRoll
:
Control
{
private
Color
rollColor
=
Color
.
FromArgb
(
0
,
122
,
204
);
[
Description
(
"滚动的颜色"
),
Category
(
"自定义"
)]
public
Color
RollColor
{
get
{
return
rollColor
;
}
set
{
rollColor
=
value
;
}
}
[
Description
(
"是否滚动"
),
Category
(
"自定义"
)]
public
bool
Roll
{
get
{
return
timer
.
Enabled
;
}
set
{
timer
.
Enabled
=
value
;
}
}
[
Description
(
"滚动间隔时间"
),
Category
(
"自定义"
)]
public
int
SplitTime
{
get
{
return
timer
.
Interval
;
}
set
{
timer
.
Interval
=
value
;
}
}
Timer
timer
=
new
Timer
();
public
UCProcessRoll
()
{
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
.
SizeChanged
+=
UCProcessRoll_SizeChanged
;
this
.
Size
=
new
Size
(
300
,
3
);
this
.
BackColor
=
Color
.
White
;
timer
.
Interval
=
30
;
timer
.
Tick
+=
timer_Tick
;
timer
.
Enabled
=
true
;
}
Rectangle
workRect
;
void
UCProcessRoll_SizeChanged
(
object
sender
,
EventArgs
e
)
{
workRect
=
new
Rectangle
(-
this
.
Width
/
3
,
0
,
this
.
Width
/
3
,
this
.
Height
);
}
protected
override
void
OnPaint
(
PaintEventArgs
e
)
{
base
.
OnPaint
(
e
);
var
g
=
e
.
Graphics
;
g
.
SetGDIHigh
();
var
r1
=
new
RectangleF
(
new
Point
(
workRect
.
Left
-
1
,
workRect
.
Top
),
new
Size
(
workRect
.
Width
/
3
+
1
,
workRect
.
Height
));
var
r2
=
new
RectangleF
(
new
Point
(
workRect
.
Right
-
workRect
.
Width
/
3
,
workRect
.
Top
),
new
Size
(
workRect
.
Width
/
3
,
workRect
.
Height
));
LinearGradientBrush
lgb1
=
new
LinearGradientBrush
(
r1
,
Color
.
FromArgb
(
0
,
rollColor
),
rollColor
,
0f
);
LinearGradientBrush
lgb2
=
new
LinearGradientBrush
(
r2
,
rollColor
,
Color
.
FromArgb
(
0
,
rollColor
),
0f
);
g
.
FillRectangle
(
lgb1
,
new
Rectangle
(
new
Point
(
workRect
.
Left
,
workRect
.
Top
),
new
Size
(
workRect
.
Width
/
3
,
workRect
.
Height
)));
g
.
FillRectangle
(
new
SolidBrush
(
rollColor
),
new
RectangleF
(
workRect
.
Left
+
workRect
.
Width
/
3
-
1
,
workRect
.
Top
,
workRect
.
Width
/
3
+
3
,
workRect
.
Height
));
g
.
FillRectangle
(
lgb2
,
r2
);
}
void
timer_Tick
(
object
sender
,
EventArgs
e
)
{
if
(
workRect
!=
null
)
{
workRect
=
new
Rectangle
(
workRect
.
Left
+
10
,
0
,
this
.
Width
/
3
,
this
.
Height
);
if
(
workRect
.
Left
>=
this
.
ClientRectangle
.
Right
)
{
workRect
=
new
Rectangle
(-
this
.
Width
/
3
,
0
,
this
.
Width
/
3
,
this
.
Height
);
}
Invalidate
();
}
}
}
}
HZH_Controls/HZH_Controls/HZH_Controls.csproj
查看文件 @
d4c5076
...
@@ -149,6 +149,9 @@
...
@@ -149,6 +149,9 @@
<Compile Include="Controls\Panel\UCPanelQuote.cs">
<Compile Include="Controls\Panel\UCPanelQuote.cs">
<SubType>Component</SubType>
<SubType>Component</SubType>
</Compile>
</Compile>
<Compile Include="Controls\Process\UCProcessRoll.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\Sampling\UCSampling.cs">
<Compile Include="Controls\Sampling\UCSampling.cs">
<SubType>UserControl</SubType>
<SubType>UserControl</SubType>
</Compile>
</Compile>
...
...
HZH_Controls/Test/UC/UCTestProcess.Designer.cs
查看文件 @
d4c5076
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论