Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b59938b4
由
HZH
编写于
2019-09-23 14:20:43 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
饼状图
1 个父辈
fed1749f
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
893 行增加
和
5 行删除
HZH_Controls/HZH_Controls/Controls/Charts/AuxiliaryLine.cs → HZH_Controls/HZH_Controls/Controls/Charts/BarChart/AuxiliaryLine.cs
HZH_Controls/HZH_Controls/Controls/Charts/BarChartItem.cs → HZH_Controls/HZH_Controls/Controls/Charts/BarChart/BarChartItem.cs
HZH_Controls/HZH_Controls/Controls/Charts/UCBarChart.cs → HZH_Controls/HZH_Controls/Controls/Charts/BarChart/UCBarChart.cs
HZH_Controls/HZH_Controls/Controls/Charts/PieChart/PieItem.cs
HZH_Controls/HZH_Controls/Controls/Charts/PieChart/UCPieChart.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/UCTestPieCharts.Designer.cs
HZH_Controls/Test/UC/UCTestPieCharts.cs
HZH_Controls/Test/UC/UCTestPieCharts.resx
HZH_Controls/HZH_Controls/Controls/Charts/AuxiliaryLine.cs
→
HZH_Controls/HZH_Controls/Controls/Charts/
BarChart/
AuxiliaryLine.cs
查看文件 @
b59938b
文件被删除
HZH_Controls/HZH_Controls/Controls/Charts/BarChartItem.cs
→
HZH_Controls/HZH_Controls/Controls/Charts/BarChart
/BarChart
Item.cs
查看文件 @
b59938b
文件被删除
HZH_Controls/HZH_Controls/Controls/Charts/UCBarChart.cs
→
HZH_Controls/HZH_Controls/Controls/Charts/
BarChart/
UCBarChart.cs
查看文件 @
b59938b
...
...
@@ -927,7 +927,7 @@ namespace HZH_Controls.Controls
base
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
ForeColor
=
System
.
Drawing
.
Color
.
Black
;
base
.
Name
=
"
Hsl
BarChart"
;
base
.
Name
=
"
UC
BarChart"
;
base
.
Size
=
new
System
.
Drawing
.
Size
(
440
,
264
);
ResumeLayout
(
false
);
}
...
...
HZH_Controls/HZH_Controls/Controls/Charts/PieChart/PieItem.cs
0 → 100644
查看文件 @
b59938b
using
System.Drawing
;
namespace
HZH_Controls.Controls
{
public
class
PieItem
{
public
string
Name
{
get
;
set
;
}
public
int
Value
{
get
;
set
;
}
/// <summary>
/// Gets or sets the color of the pie.如果为空则使用默认颜色
/// </summary>
/// <value>The color of the pie.</value>
public
Color
?
PieColor
{
get
;
set
;
}
}
}
HZH_Controls/HZH_Controls/Controls/Charts/PieChart/UCPieChart.cs
0 → 100644
查看文件 @
b59938b
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-23
//
// ***********************************************************************
// <copyright file="UCPieChart.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.ComponentModel
;
using
System.ComponentModel.Design
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Drawing.Text
;
using
System.Linq
;
using
System.Windows.Forms
;
namespace
HZH_Controls.Controls
{
/// <summary>
/// Class UCPieChart.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public
class
UCPieChart
:
UserControl
{
/// <summary>
/// The percent color
/// </summary>
private
Color
percentColor
=
Color
.
DodgerBlue
;
/// <summary>
/// The pie items
/// </summary>
private
PieItem
[]
pieItems
=
new
PieItem
[
0
];
/// <summary>
/// The random
/// </summary>
private
Random
random
=
null
;
/// <summary>
/// The format center
/// </summary>
private
StringFormat
formatCenter
=
null
;
/// <summary>
/// The margin
/// </summary>
private
int
margin
=
50
;
/// <summary>
/// The m is render percent
/// </summary>
private
bool
m_IsRenderPercent
=
false
;
/// <summary>
/// The percen format
/// </summary>
private
string
percenFormat
=
"{0:F2}%"
;
/// <summary>
/// The components
/// </summary>
private
IContainer
components
=
null
;
/// <summary>
/// Gets or sets a value indicating whether this instance is render percent.
/// </summary>
/// <value><c>true</c> if this instance is render percent; otherwise, <c>false</c>.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
DefaultValue
(
false
)]
[
Description
(
"获取或设置是否显示百分比占用"
)]
public
bool
IsRenderPercent
{
get
{
return
m_IsRenderPercent
;
}
set
{
m_IsRenderPercent
=
value
;
Invalidate
();
}
}
/// <summary>
/// Gets or sets the text margin.
/// </summary>
/// <value>The text margin.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置文本距离,单位为像素,默认50"
)]
[
DefaultValue
(
50
)]
public
int
TextMargin
{
get
{
return
margin
;
}
set
{
margin
=
value
;
Invalidate
();
}
}
/// <summary>
/// Gets or sets the percent format.
/// </summary>
/// <value>The percent format.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置文百分比文字的格式化信息"
)]
[
DefaultValue
(
"{0:F2}%"
)]
public
string
PercentFormat
{
get
{
return
percenFormat
;
}
set
{
percenFormat
=
value
;
Invalidate
();
}
}
/// <summary>
/// The center of circle color
/// </summary>
private
Color
centerOfCircleColor
=
Color
.
White
;
/// <summary>
/// Gets or sets the color of the center of circle.
/// </summary>
/// <value>The color of the center of circle.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置圆心颜色"
)]
public
Color
CenterOfCircleColor
{
get
{
return
centerOfCircleColor
;
}
set
{
centerOfCircleColor
=
value
;
Invalidate
();
}
}
/// <summary>
/// The center of circle width
/// </summary>
private
int
centerOfCircleWidth
=
0
;
/// <summary>
/// Gets or sets the width of the center of circle.
/// </summary>
/// <value>The width of the center of circle.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置圆心宽度"
)]
public
int
CenterOfCircleWidth
{
get
{
return
centerOfCircleWidth
;
}
set
{
if
(
value
<
0
)
return
;
centerOfCircleWidth
=
value
;
Invalidate
();
}
}
/// <summary>
/// The title
/// </summary>
private
string
title
;
/// <summary>
/// Gets or sets the ti tle.
/// </summary>
/// <value>The ti tle.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置标题"
)]
public
string
TiTle
{
get
{
return
title
;
}
set
{
title
=
value
;
ResetTitleHeight
();
Invalidate
();
}
}
/// <summary>
/// The title font
/// </summary>
private
Font
titleFont
=
new
Font
(
"微软雅黑"
,
12
);
/// <summary>
/// Gets or sets the title font.
/// </summary>
/// <value>The title font.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置标题字体"
)]
public
Font
TitleFont
{
get
{
return
titleFont
;
}
set
{
titleFont
=
value
;
ResetTitleHeight
();
Invalidate
();
}
}
/// <summary>
/// The title froe color
/// </summary>
private
Color
titleFroeColor
=
Color
.
Black
;
/// <summary>
/// Gets or sets the color of the title froe.
/// </summary>
/// <value>The color of the title froe.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置标题颜色"
)]
public
Color
TitleFroeColor
{
get
{
return
titleFroeColor
;
}
set
{
titleFroeColor
=
value
;
Invalidate
();
}
}
/// <summary>
/// The title size
/// </summary>
private
SizeF
titleSize
=
SizeF
.
Empty
;
/// <summary>
/// Resets the height of the title.
/// </summary>
private
void
ResetTitleHeight
()
{
if
(
string
.
IsNullOrEmpty
(
title
))
titleSize
=
SizeF
.
Empty
;
else
{
using
(
var
g
=
this
.
CreateGraphics
())
{
titleSize
=
g
.
MeasureString
(
title
,
titleFont
);
}
}
}
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
[
Browsable
(
true
)]
[
Category
(
"自定义"
)]
[
Description
(
"获取或设置标题颜色"
)]
[
Localizable
(
true
)]
public
PieItem
[]
DataSource
{
get
{
return
pieItems
;
}
set
{
pieItems
=
value
;
Invalidate
();
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCPieChart"/> class.
/// </summary>
public
UCPieChart
()
{
InitializeComponent
();
random
=
new
Random
();
formatCenter
=
new
StringFormat
();
formatCenter
.
Alignment
=
StringAlignment
.
Center
;
formatCenter
.
LineAlignment
=
StringAlignment
.
Center
;
SetStyle
(
ControlStyles
.
UserPaint
|
ControlStyles
.
SupportsTransparentBackColor
,
true
);
SetStyle
(
ControlStyles
.
ResizeRedraw
,
true
);
SetStyle
(
ControlStyles
.
OptimizedDoubleBuffer
,
true
);
SetStyle
(
ControlStyles
.
AllPaintingInWmPaint
,
true
);
pieItems
=
new
PieItem
[
0
];
if
(
GetService
(
typeof
(
IDesignerHost
))
!=
null
||
LicenseManager
.
UsageMode
==
LicenseUsageMode
.
Designtime
)
{
pieItems
=
new
PieItem
[
5
];
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
pieItems
[
i
]
=
new
PieItem
{
Name
=
"Source"
+
(
i
+
1
),
Value
=
random
.
Next
(
10
,
100
)
};
}
}
}
/// <summary>
/// Sets the margin paint.
/// </summary>
/// <param name="value">The value.</param>
private
void
SetMarginPaint
(
int
value
)
{
if
(
value
>
500
)
{
margin
=
80
;
}
else
if
(
value
>
300
)
{
margin
=
60
;
}
else
{
margin
=
40
;
}
}
/// <summary>
/// Gets the center point.
/// </summary>
/// <param name="width">The width.</param>
/// <returns>Point.</returns>
private
Point
GetCenterPoint
(
out
int
width
)
{
width
=
Math
.
Min
(
base
.
Width
,
base
.
Height
-
(
titleSize
!=
SizeF
.
Empty
?
((
int
)
titleSize
.
Height
)
:
0
))
/
2
-
margin
-
8
;
return
new
Point
(
base
.
Width
/
2
-
1
,
base
.
Height
/
2
+
(
titleSize
!=
SizeF
.
Empty
?
((
int
)
titleSize
.
Height
)
:
0
)
-
1
);
}
/// <summary>
/// Gets the random color.
/// </summary>
/// <returns>Color.</returns>
private
Color
GetRandomColor
()
{
int
num
=
random
.
Next
(
256
);
int
num2
=
random
.
Next
(
256
);
int
blue
=
(
num
+
num2
>
430
)
?
random
.
Next
(
100
)
:
random
.
Next
(
200
);
return
Color
.
FromArgb
(
num
,
num2
,
blue
);
}
/// <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
)
{
e
.
Graphics
.
SetGDIHigh
();
int
width
;
Point
centerPoint
=
GetCenterPoint
(
out
width
);
Rectangle
rectangle
=
new
Rectangle
(
centerPoint
.
X
-
width
,
centerPoint
.
Y
-
width
,
width
*
2
,
width
*
2
);
if
(
width
>
0
&&
pieItems
.
Length
!=
0
)
{
if
(!
string
.
IsNullOrEmpty
(
title
))
e
.
Graphics
.
DrawString
(
title
,
titleFont
,
new
SolidBrush
(
titleFroeColor
),
new
PointF
((
this
.
Width
-
titleSize
.
Width
)
/
2
,
5
));
//e.Graphics.FillEllipse(Brushes.AliceBlue, rectangle);
//e.Graphics.DrawEllipse(Pens.DodgerBlue, rectangle);
Rectangle
rect
=
new
Rectangle
(
rectangle
.
X
-
centerPoint
.
X
,
rectangle
.
Y
-
centerPoint
.
Y
,
rectangle
.
Width
,
rectangle
.
Height
);
e
.
Graphics
.
TranslateTransform
(
centerPoint
.
X
,
centerPoint
.
Y
);
e
.
Graphics
.
RotateTransform
(
90f
);
e
.
Graphics
.
DrawLine
(
Pens
.
DimGray
,
0
,
0
,
width
,
0
);
int
num
=
pieItems
.
Sum
((
PieItem
item
)
=>
item
.
Value
);
float
num2
=
0f
;
float
num3
=
-
90f
;
for
(
int
i
=
0
;
i
<
pieItems
.
Length
;
i
++)
{
Color
cItem
=
pieItems
[
i
].
PieColor
??
ControlHelper
.
Colors
[
i
];
Pen
pen
=
new
Pen
(
cItem
,
1f
);
SolidBrush
solidBrush
=
new
SolidBrush
(
cItem
);
SolidBrush
solidBrush2
=
new
SolidBrush
(
cItem
);
Brush
percentBrush
=
new
SolidBrush
(
cItem
);
float
num4
=
e
.
Graphics
.
MeasureString
(
pieItems
[
i
].
Name
,
Font
).
Width
+
3f
;
float
num5
=
(
num
!=
0
)
?
Convert
.
ToSingle
((
double
)
pieItems
[
i
].
Value
*
1.0
/
(
double
)
num
*
360.0
)
:
((
float
)(
360
/
pieItems
.
Length
));
e
.
Graphics
.
FillPie
(
solidBrush
,
rect
,
0f
,
0f
-
num5
);
e
.
Graphics
.
DrawPie
(
new
Pen
(
solidBrush
),
rect
,
0f
,
0f
-
num5
);
e
.
Graphics
.
RotateTransform
(
0f
-
num5
/
2f
);
if
(
num5
<
2f
)
{
num2
+=
num5
;
}
else
{
num2
+=
num5
/
2f
;
int
num6
=
15
;
if
(
num2
<
45f
||
num2
>
315f
)
{
num6
=
20
;
}
if
(
num2
>
135f
&&
num2
<
225f
)
{
num6
=
20
;
}
e
.
Graphics
.
DrawLine
(
pen
,
width
*
2
/
3
,
0
,
width
+
num6
,
0
);
e
.
Graphics
.
TranslateTransform
(
width
+
num6
,
0f
);
if
(
num2
-
num3
<
5f
)
{
}
num3
=
num2
;
if
(
num2
<
180f
)
{
e
.
Graphics
.
RotateTransform
(
num2
-
90f
);
e
.
Graphics
.
DrawLine
(
pen
,
0f
,
0f
,
num4
,
0f
);
e
.
Graphics
.
DrawString
(
pieItems
[
i
].
Name
,
Font
,
solidBrush2
,
new
Point
(
0
,
-
Font
.
Height
));
if
(
IsRenderPercent
)
{
e
.
Graphics
.
DrawString
(
string
.
Format
(
percenFormat
,
num5
*
100f
/
360f
),
Font
,
percentBrush
,
new
Point
(
0
,
1
));
}
e
.
Graphics
.
RotateTransform
(
90f
-
num2
);
}
else
{
e
.
Graphics
.
RotateTransform
(
num2
-
270f
);
e
.
Graphics
.
DrawLine
(
pen
,
0f
,
0f
,
num4
,
0f
);
e
.
Graphics
.
TranslateTransform
(
num4
-
3f
,
0f
);
e
.
Graphics
.
RotateTransform
(
180f
);
e
.
Graphics
.
DrawString
(
pieItems
[
i
].
Name
,
Font
,
solidBrush2
,
new
Point
(
0
,
-
Font
.
Height
));
if
(
IsRenderPercent
)
{
e
.
Graphics
.
DrawString
(
string
.
Format
(
percenFormat
,
num5
*
100f
/
360f
),
Font
,
percentBrush
,
new
Point
(
0
,
1
));
}
e
.
Graphics
.
RotateTransform
(-
180f
);
e
.
Graphics
.
TranslateTransform
(
0f
-
num4
+
3f
,
0f
);
e
.
Graphics
.
RotateTransform
(
270f
-
num2
);
}
e
.
Graphics
.
TranslateTransform
(-
width
-
num6
,
0f
);
e
.
Graphics
.
RotateTransform
(
0f
-
num5
/
2f
);
num2
+=
num5
/
2f
;
}
solidBrush
.
Dispose
();
pen
.
Dispose
();
solidBrush2
.
Dispose
();
percentBrush
.
Dispose
();
}
e
.
Graphics
.
ResetTransform
();
if
(
centerOfCircleWidth
>
0
)
{
Rectangle
rectCenter
=
new
Rectangle
(
rect
.
Left
+
rect
.
Width
/
2
-
centerOfCircleWidth
/
2
,
rect
.
Top
+
rect
.
Height
/
2
-
centerOfCircleWidth
/
2
,
centerOfCircleWidth
,
centerOfCircleWidth
);
e
.
Graphics
.
FillEllipse
(
new
SolidBrush
(
centerOfCircleColor
),
rectCenter
);
}
}
else
{
e
.
Graphics
.
FillEllipse
(
Brushes
.
AliceBlue
,
rectangle
);
e
.
Graphics
.
DrawEllipse
(
Pens
.
DodgerBlue
,
rectangle
);
e
.
Graphics
.
DrawString
(
"空"
,
Font
,
Brushes
.
DimGray
,
rectangle
,
formatCenter
);
}
base
.
OnPaint
(
e
);
}
/// <summary>
/// Sets the data source.
/// </summary>
/// <param name="source">The source.</param>
public
void
SetDataSource
(
PieItem
[]
source
)
{
if
(
source
!=
null
)
{
DataSource
=
source
;
}
}
/// <summary>
/// Sets the data source.
/// </summary>
/// <param name="names">The names.</param>
/// <param name="values">The values.</param>
/// <exception cref="System.ArgumentNullException">
/// names
/// or
/// values
/// </exception>
/// <exception cref="System.Exception">两个数组的长度不一致!</exception>
public
void
SetDataSource
(
string
[]
names
,
int
[]
values
)
{
if
(
names
==
null
)
{
throw
new
ArgumentNullException
(
"names"
);
}
if
(
values
==
null
)
{
throw
new
ArgumentNullException
(
"values"
);
}
if
(
names
.
Length
!=
values
.
Length
)
{
throw
new
Exception
(
"两个数组的长度不一致!"
);
}
pieItems
=
new
PieItem
[
names
.
Length
];
for
(
int
i
=
0
;
i
<
names
.
Length
;
i
++)
{
pieItems
[
i
]
=
new
PieItem
{
Name
=
names
[
i
],
Value
=
values
[
i
]
};
}
Invalidate
();
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing">为 true 则释放托管资源和非托管资源;为 false 则仅释放非托管资源。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
components
!=
null
)
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
/// <summary>
/// Initializes the component.
/// </summary>
private
void
InitializeComponent
()
{
SuspendLayout
();
base
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
base
.
Name
=
"UCPieChart"
;
ResumeLayout
(
false
);
}
}
}
HZH_Controls/HZH_Controls/HZH_Controls.csproj
查看文件 @
b59938b
...
...
@@ -46,18 +46,22 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\Charts\AuxiliaryLine.cs" />
<Compile Include="Controls\Charts\
BarChart\
AuxiliaryLine.cs" />
<Compile Include="Controls\Charts\Axis.cs" />
<Compile Include="Controls\Charts\AxisCollection.cs" />
<Compile Include="Controls\Charts\AxisFormat.cs" />
<Compile Include="Controls\Charts\AxisLabel.cs" />
<Compile Include="Controls\Charts\AxisPosition.cs" />
<Compile Include="Controls\Charts\AxisType.cs" />
<Compile Include="Controls\Charts\BarChartItem.cs" />
<Compile Include="Controls\Charts\BarChart
\BarChart
Item.cs" />
<Compile Include="Controls\Charts\ChartPoint.cs" />
<Compile Include="Controls\Charts\ChartPointCollection.cs" />
<Compile Include="Controls\Charts\ChartPointEventArgs.cs" />
<Compile Include="Controls\Charts\ChartPointEventHandler.cs" />
<Compile Include="Controls\Charts\PieChart\UCPieChart.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Charts\PieChart\PieItem.cs" />
<Compile Include="Controls\ScrollBar\ScrollbarComponent.cs">
<SubType>Component</SubType>
</Compile>
...
...
@@ -66,7 +70,7 @@
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Helpers\GraphDirection.cs" />
<Compile Include="Controls\Charts\UCBarChart.cs">
<Compile Include="Controls\Charts\
BarChart\
UCBarChart.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Charts\UCChart.cs">
...
...
HZH_Controls/HZH_Controls/Helpers/ControlHelper.cs
查看文件 @
b59938b
...
...
@@ -816,9 +816,22 @@ namespace HZH_Controls
static
ControlHelper
()
{
List
<
Color
>
list
=
new
List
<
Color
>();
list
.
Add
(
Color
.
FromArgb
(
55
,
162
,
218
));
list
.
Add
(
Color
.
FromArgb
(
50
,
197
,
233
));
list
.
Add
(
Color
.
FromArgb
(
103
,
224
,
227
));
list
.
Add
(
Color
.
FromArgb
(
159
,
230
,
184
));
list
.
Add
(
Color
.
FromArgb
(
255
,
219
,
92
));
list
.
Add
(
Color
.
FromArgb
(
255
,
159
,
127
));
list
.
Add
(
Color
.
FromArgb
(
251
,
114
,
147
));
list
.
Add
(
Color
.
FromArgb
(
224
,
98
,
174
));
list
.
Add
(
Color
.
FromArgb
(
230
,
144
,
209
));
list
.
Add
(
Color
.
FromArgb
(
231
,
188
,
243
));
list
.
Add
(
Color
.
FromArgb
(
157
,
150
,
245
));
list
.
Add
(
Color
.
FromArgb
(
131
,
120
,
234
));
list
.
Add
(
Color
.
FromArgb
(
150
,
191
,
255
));
list
.
Add
(
Color
.
FromArgb
(
243
,
67
,
54
));
list
.
Add
(
Color
.
FromArgb
(
156
,
39
,
176
));
list
.
Add
(
Color
.
FromArgb
(
233
,
30
,
99
));
list
.
Add
(
Color
.
FromArgb
(
103
,
58
,
183
));
list
.
Add
(
Color
.
FromArgb
(
63
,
81
,
181
));
list
.
Add
(
Color
.
FromArgb
(
33
,
150
,
243
));
...
...
@@ -828,6 +841,7 @@ namespace HZH_Controls
list
.
Add
(
Color
.
FromArgb
(
139
,
195
,
74
));
list
.
Add
(
Color
.
FromArgb
(
76
,
175
,
80
));
list
.
Add
(
Color
.
FromArgb
(
204
,
219
,
57
));
list
.
Add
(
Color
.
FromArgb
(
233
,
30
,
99
));
list
.
Add
(
Color
.
FromArgb
(
254
,
234
,
59
));
list
.
Add
(
Color
.
FromArgb
(
254
,
192
,
7
));
list
.
Add
(
Color
.
FromArgb
(
254
,
152
,
0
));
...
...
HZH_Controls/Test/FrmMain.cs
查看文件 @
b59938b
...
...
@@ -64,6 +64,7 @@ namespace Test
tnControl
.
Nodes
.
Add
(
"组织结构图"
);
tnCharts
.
Nodes
.
Add
(
"滚动图表"
);
tnCharts
.
Nodes
.
Add
(
"柱状图"
);
tnCharts
.
Nodes
.
Add
(
"饼状图"
);
this
.
tvMenu
.
Nodes
.
Add
(
tnCharts
);
TreeNode
tnFactory
=
new
TreeNode
(
" 工业控件"
);
...
...
@@ -211,6 +212,9 @@ namespace Test
case
"柱状图"
:
AddControl
(
new
UC
.
UCTestBarcharts
());
break
;
case
"饼状图"
:
AddControl
(
new
UC
.
UCTestPieCharts
());
break
;
case
"滚动图表"
:
AddControl
(
new
UC
.
UCTestWaveChart
()
{
Dock
=
DockStyle
.
Fill
});
break
;
...
...
HZH_Controls/Test/Test.csproj
查看文件 @
b59938b
...
...
@@ -194,6 +194,12 @@
<Compile Include="UC\UCTestPanelTitle.Designer.cs">
<DependentUpon>UCTestPanelTitle.cs</DependentUpon>
</Compile>
<Compile Include="UC\UCTestPieCharts.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC\UCTestPieCharts.Designer.cs">
<DependentUpon>UCTestPieCharts.cs</DependentUpon>
</Compile>
<Compile Include="UC\UCTestProcess.cs">
<SubType>UserControl</SubType>
</Compile>
...
...
@@ -359,6 +365,9 @@
<EmbeddedResource Include="UC\UCTestPanelTitle.resx">
<DependentUpon>UCTestPanelTitle.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestPieCharts.resx">
<DependentUpon>UCTestPieCharts.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestProcess.resx">
<DependentUpon>UCTestProcess.cs</DependentUpon>
</EmbeddedResource>
...
...
HZH_Controls/Test/UC/UCTestPieCharts.Designer.cs
0 → 100644
查看文件 @
b59938b
namespace
Test.UC
{
partial
class
UCTestPieCharts
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private
void
InitializeComponent
()
{
HZH_Controls
.
Controls
.
PieItem
pieItem1
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem2
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem3
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem4
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem5
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem6
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem7
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem8
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem9
=
new
HZH_Controls
.
Controls
.
PieItem
();
HZH_Controls
.
Controls
.
PieItem
pieItem10
=
new
HZH_Controls
.
Controls
.
PieItem
();
this
.
ucPieChart1
=
new
HZH_Controls
.
Controls
.
UCPieChart
();
this
.
ucPieChart2
=
new
HZH_Controls
.
Controls
.
UCPieChart
();
this
.
SuspendLayout
();
//
// ucPieChart1
//
this
.
ucPieChart1
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
ucPieChart1
.
CenterOfCircleColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucPieChart1
.
CenterOfCircleWidth
=
0
;
pieItem1
.
Name
=
"Source1"
;
pieItem1
.
PieColor
=
null
;
pieItem1
.
Value
=
27
;
pieItem2
.
Name
=
"Source2"
;
pieItem2
.
PieColor
=
null
;
pieItem2
.
Value
=
20
;
pieItem3
.
Name
=
"Source3"
;
pieItem3
.
PieColor
=
null
;
pieItem3
.
Value
=
94
;
pieItem4
.
Name
=
"Source4"
;
pieItem4
.
PieColor
=
null
;
pieItem4
.
Value
=
28
;
pieItem5
.
Name
=
"Source5"
;
pieItem5
.
PieColor
=
null
;
pieItem5
.
Value
=
84
;
this
.
ucPieChart1
.
DataSource
=
new
HZH_Controls
.
Controls
.
PieItem
[]
{
pieItem1
,
pieItem2
,
pieItem3
,
pieItem4
,
pieItem5
};
this
.
ucPieChart1
.
IsRenderPercent
=
true
;
this
.
ucPieChart1
.
Location
=
new
System
.
Drawing
.
Point
(
50
,
71
);
this
.
ucPieChart1
.
Name
=
"ucPieChart1"
;
this
.
ucPieChart1
.
Size
=
new
System
.
Drawing
.
Size
(
342
,
298
);
this
.
ucPieChart1
.
TabIndex
=
1
;
this
.
ucPieChart1
.
TiTle
=
null
;
this
.
ucPieChart1
.
TitleFont
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
);
this
.
ucPieChart1
.
TitleFroeColor
=
System
.
Drawing
.
Color
.
Black
;
//
// ucPieChart2
//
this
.
ucPieChart2
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
ucPieChart2
.
CenterOfCircleColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucPieChart2
.
CenterOfCircleWidth
=
0
;
pieItem6
.
Name
=
"Source1"
;
pieItem6
.
PieColor
=
null
;
pieItem6
.
Value
=
27
;
pieItem7
.
Name
=
"Source2"
;
pieItem7
.
PieColor
=
null
;
pieItem7
.
Value
=
20
;
pieItem8
.
Name
=
"Source3"
;
pieItem8
.
PieColor
=
null
;
pieItem8
.
Value
=
94
;
pieItem9
.
Name
=
"Source4"
;
pieItem9
.
PieColor
=
null
;
pieItem9
.
Value
=
28
;
pieItem10
.
Name
=
"Source5"
;
pieItem10
.
PieColor
=
null
;
pieItem10
.
Value
=
84
;
this
.
ucPieChart2
.
DataSource
=
new
HZH_Controls
.
Controls
.
PieItem
[]
{
pieItem6
,
pieItem7
,
pieItem8
,
pieItem9
,
pieItem10
};
this
.
ucPieChart2
.
Location
=
new
System
.
Drawing
.
Point
(
415
,
20
);
this
.
ucPieChart2
.
Name
=
"ucPieChart2"
;
this
.
ucPieChart2
.
Size
=
new
System
.
Drawing
.
Size
(
395
,
349
);
this
.
ucPieChart2
.
TabIndex
=
0
;
this
.
ucPieChart2
.
TiTle
=
"有标题的饼状图"
;
this
.
ucPieChart2
.
TitleFont
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
);
this
.
ucPieChart2
.
TitleFroeColor
=
System
.
Drawing
.
Color
.
Black
;
//
// UCTestPieCharts
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
Controls
.
Add
(
this
.
ucPieChart1
);
this
.
Controls
.
Add
(
this
.
ucPieChart2
);
this
.
Name
=
"UCTestPieCharts"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
813
,
493
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
UCTestPieCharts_Load
);
this
.
ResumeLayout
(
false
);
}
#
endregion
private
HZH_Controls
.
Controls
.
UCPieChart
ucPieChart2
;
private
HZH_Controls
.
Controls
.
UCPieChart
ucPieChart1
;
}
}
HZH_Controls/Test/UC/UCTestPieCharts.cs
0 → 100644
查看文件 @
b59938b
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
;
namespace
Test.UC
{
public
partial
class
UCTestPieCharts
:
UserControl
{
public
UCTestPieCharts
()
{
InitializeComponent
();
}
private
void
UCTestPieCharts_Load
(
object
sender
,
EventArgs
e
)
{
Random
r
=
new
Random
();
var
pieItems
=
new
PieItem
[
5
];
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
pieItems
[
i
]
=
new
PieItem
{
Name
=
"Source"
+
(
i
+
1
),
Value
=
r
.
Next
(
10
,
100
)
};
}
this
.
ucPieChart1
.
SetDataSource
(
pieItems
);
this
.
ucPieChart2
.
SetDataSource
(
pieItems
);
}
}
}
HZH_Controls/Test/UC/UCTestPieCharts.resx
0 → 100644
查看文件 @
b59938b
<?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>
</root>
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论