ChartBase.cs
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace zhouchen.chart.chart
{
public enum ChartType
{
Chart_Unknow, // 未知类型
Chart_Straight, // 直线
Chart_Rectangular, // 矩形
Chart_Cnt,
}
public abstract class ChartBase: INotifyPropertyChanged
{
protected static int SPACE_HALF = 5;
protected static int SPACE_FULL = 10;
protected static Color COLOR_SELECT_LINE = Color.Gray;
protected static Color COLOR_SELECT_FILL = Color.White;
protected ChartType _chartType = ChartType.Chart_Unknow;
public ChartType chartType
{
get { return _chartType; }
}
#region 变量通知
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
#endregion
#region 变量
protected uint _nLineWidth = 2;
public uint LineWidth
{
get { return _nLineWidth; }
set {
_nLineWidth = value;
NotifyPropertyChanged("LineWidth");
}
}
protected Color _ColorLine = Color.Black;
public Color LineColor
{
get { return _ColorLine; }
set {
_ColorLine = value;
NotifyPropertyChanged("LineColor");
}
}
// 旋转中心
protected Point _ptCenter = new Point(0,0);
public Point ptCenter
{
get { return _ptCenter; }
set { _ptCenter = value;}
}
// 旋转矩阵
protected Matrix _matrix = new Matrix();
// 旋转角度
protected double _dRoute = 0.0;
public double Route
{
get { return _dRoute; }
set {
_matrix.RotateAt((float)(value - _dRoute), _ptCenter);
_dRoute = value;
NotifyPropertyChanged("Route");
}
}
protected bool _IsSelect = false;
public bool IsSelect {
get { return _IsSelect; }
set {
_IsSelect = value;
NotifyPropertyChanged("IsSelect");
}
}
#endregion
public abstract void DrawChart(Graphics graph, Matrix matrix);
}
}