Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d864f644
由
HZH
编写于
2019-08-29 11:38:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改滑块颜色
1 个父辈
e2d76073
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
9 行删除
HZH_Controls/HZH_Controls/Controls/TrackBar/UCTrackBar.cs
HZH_Controls/Test/Form2.Designer.cs
HZH_Controls/HZH_Controls/Controls/TrackBar/UCTrackBar.cs
查看文件 @
d864f64
...
...
@@ -73,7 +73,7 @@ namespace HZH_Controls.Controls
if
(
value
>
maxValue
||
value
<
minValue
)
return
;
var
v
=
(
float
)
Math
.
Round
((
double
)
value
,
dcimalDigits
);
if
(
value
==
v
)
if
(
m_
value
==
v
)
return
;
this
.
m_value
=
v
;
this
.
Refresh
();
...
...
@@ -84,7 +84,7 @@ namespace HZH_Controls.Controls
}
}
private
Color
m_lineColor
=
Color
.
FromArgb
(
2
55
,
77
,
59
);
private
Color
m_lineColor
=
Color
.
FromArgb
(
2
28
,
231
,
237
);
[
Description
(
"线颜色"
),
Category
(
"自定义"
)]
public
Color
LineColor
...
...
@@ -96,6 +96,20 @@ namespace HZH_Controls.Controls
this
.
Refresh
();
}
}
private
Color
m_valueColor
=
Color
.
FromArgb
(
255
,
77
,
59
);
[
Description
(
"值颜色"
),
Category
(
"自定义"
)]
public
Color
ValueColor
{
get
{
return
m_valueColor
;
}
set
{
m_valueColor
=
value
;
this
.
Refresh
();
}
}
RectangleF
m_lineRectangle
;
RectangleF
m_trackRectangle
;
...
...
@@ -143,8 +157,13 @@ namespace HZH_Controls.Controls
m_lineRectangle
=
new
RectangleF
(
lineWidth
,
(
this
.
Size
.
Height
-
lineWidth
)
/
2
,
this
.
Size
.
Width
-
lineWidth
*
2
,
lineWidth
);
GraphicsPath
pathLine
=
ControlHelper
.
CreateRoundedRectanglePath
(
m_lineRectangle
,
5
);
g
.
FillPath
(
new
SolidBrush
(
m_lineColor
),
pathLine
);
GraphicsPath
valueLine
=
ControlHelper
.
CreateRoundedRectanglePath
(
new
RectangleF
(
lineWidth
,
(
this
.
Size
.
Height
-
lineWidth
)
/
2
,
((
float
)
m_value
/
(
float
)(
maxValue
-
minValue
))
*
m_lineRectangle
.
Width
,
lineWidth
),
5
);
g
.
FillPath
(
new
SolidBrush
(
m_valueColor
),
valueLine
);
m_trackRectangle
=
new
RectangleF
(
m_lineRectangle
.
Left
-
lineWidth
+
(((
float
)
m_value
/
(
float
)(
maxValue
-
minValue
))
*
(
this
.
Size
.
Width
-
lineWidth
*
2
)),
(
this
.
Size
.
Height
-
lineWidth
*
2
)
/
2
,
lineWidth
*
2
,
lineWidth
*
2
);
g
.
FillEllipse
(
new
SolidBrush
(
m_
lin
eColor
),
m_trackRectangle
);
g
.
FillEllipse
(
new
SolidBrush
(
m_
valu
eColor
),
m_trackRectangle
);
g
.
FillEllipse
(
Brushes
.
White
,
new
RectangleF
(
m_trackRectangle
.
X
+
m_trackRectangle
.
Width
/
4
,
m_trackRectangle
.
Y
+
m_trackRectangle
.
Height
/
4
,
m_trackRectangle
.
Width
/
2
,
m_trackRectangle
.
Height
/
2
));
}
}
...
...
HZH_Controls/Test/Form2.Designer.cs
查看文件 @
d864f64
...
...
@@ -138,15 +138,18 @@
//
// ucTrackBar1
//
this
.
ucTrackBar1
.
LineWidth
=
10
;
this
.
ucTrackBar1
.
Location
=
new
System
.
Drawing
.
Point
(
833
,
403
);
this
.
ucTrackBar1
.
MaxValue
=
100
;
this
.
ucTrackBar1
.
MinValue
=
0
;
this
.
ucTrackBar1
.
DcimalDigits
=
0
;
this
.
ucTrackBar1
.
LineColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
228
)))),
((
int
)(((
byte
)(
231
)))),
((
int
)(((
byte
)(
237
)))));
this
.
ucTrackBar1
.
LineWidth
=
10F
;
this
.
ucTrackBar1
.
Location
=
new
System
.
Drawing
.
Point
(
999
,
367
);
this
.
ucTrackBar1
.
MaxValue
=
100F
;
this
.
ucTrackBar1
.
MinValue
=
0F
;
this
.
ucTrackBar1
.
Name
=
"ucTrackBar1"
;
this
.
ucTrackBar1
.
Size
=
new
System
.
Drawing
.
Size
(
2
12
,
32
);
this
.
ucTrackBar1
.
Size
=
new
System
.
Drawing
.
Size
(
2
50
,
30
);
this
.
ucTrackBar1
.
TabIndex
=
12
;
this
.
ucTrackBar1
.
Text
=
"ucTrackBar1"
;
this
.
ucTrackBar1
.
Value
=
100
;
this
.
ucTrackBar1
.
Value
=
40F
;
this
.
ucTrackBar1
.
ValueColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
77
)))),
((
int
)(((
byte
)(
59
)))));
//
// ucProcessWave2
//
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论