-
Notifications
You must be signed in to change notification settings - Fork 0
/
LongStrip_Ruler.cs
131 lines (115 loc) · 4.53 KB
/
LongStrip_Ruler.cs
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ZYCControl
{
public partial class LongStrip_Ruler : UserControl
{
public LongStrip_Ruler()
{
InitializeComponent();
EventAndRespone();
}
private void EventAndRespone()
{
longStrip_1.RangeChange += new RangeChangedHandleEvent(rulerBarH.ResponeEvent);
longStrip_1.RangeChange += new RangeChangedHandleEvent(rulerBarV.ResponeEvent);
rulerBarH.RangeChanged += new RangeChangedHandleEvent(longStrip_1.ResponeEvent);
//rulerBarV.RangeChanged += new RangeChangedHandleEvent(longStrip_1.ResponeEvent);
}
private void longStrip_1_MouseMove(object sender, MouseEventArgs e)
{
Point np = this.PointToScreen(e.Location);
Rectangle rc_ls = RectangleToScreen(longStrip_1.ClientRectangle);
Rectangle rc_rh = RectangleToScreen(rulerBarH.ClientRectangle);
Rectangle rc_rv = RectangleToScreen(rulerBarV.ClientRectangle);
if (rc_rh.Contains(np))
rulerBarH.Select();
if (rc_rv.Contains(np))
rulerBarV.Select();
if (rc_ls.Contains(np))
longStrip_1.Select();
}
private void LongStrip_Ruler_SizeChanged(object sender, EventArgs e)
{
longStrip_1.Location = new Point(30, 0);
longStrip_1.Width = Width - 30;
longStrip_1.Height = Height - 30;
rulerBarV.Height = Height - 30;
rulerBarH.Width = Width - 30;
rulerBarH.Location = new Point(30, longStrip_1.Height);
if (rulerBarH.Width != 0 &
rulerBarV.Height != 0)
{
ReDrawRuler();
}
}
public void ReDrawRuler()
{
rulerBarH.startValue = longStrip_1.StartX;
rulerBarH.endValue = longStrip_1.EndX;
rulerBarV.startValue = longStrip_1.StartY;
rulerBarV.endValue = longStrip_1.EndY;
rulerBarH.Draw();
rulerBarV.Draw();
}
public float stepX;
public float stepY;
public float startX;
public float endX;
public float startY;
public float endY;
public string InfoFormat;
public float judge0Y;
public float judge1y;
public bool judge0Enable;
public bool judge1Enable;
public Color judge0Color;
public Color judge1Color;
private List<series> _data;
public List<series> data
{
get { return _data; }
set { _data = value; }
}
public Font tipFont;
public string tipFormat;
public string tipXunit;
public string tipYunit;
public void Initial(bool showDialog)
{
longStrip_1.StepX = stepX;
longStrip_1.StepY = stepY;
longStrip_1.StartX = startX;
longStrip_1.EndX = endX;
longStrip_1.StartY = startY;
longStrip_1.EndY = endY;
longStrip_1.NewImage(data, true, new float[] { startX, endX, startY, endY });
longStrip_1.longStripToolLayout1.JudgeLine0.InfoFormat = InfoFormat;
longStrip_1.longStripToolLayout1.JudgeLine1.InfoFormat = InfoFormat;
longStrip_1.longStripToolLayout1.JudgeLine0.Y = judge0Y;
longStrip_1.longStripToolLayout1.JudgeLine1.Y = judge1y;
longStrip_1.longStripToolLayout1.JudgeLine0.color = judge0Color;
longStrip_1.longStripToolLayout1.JudgeLine1.color = judge1Color;
longStrip_1.longStripToolLayout1.JudgeLine0.Enable = judge0Enable;
longStrip_1.longStripToolLayout1.JudgeLine1.Enable = judge1Enable;
longStrip_1.longStripToolLayout1.infoShow.data = data;
longStrip_1.longStripToolLayout1.infoShow.StrFormat = tipFormat;
longStrip_1.longStripToolLayout1.infoShow.startx0 = startX;
longStrip_1.longStripToolLayout1.infoShow.font = tipFont;
longStrip_1.longStripToolLayout1.infoShow.UnitX = tipXunit;
longStrip_1.longStripToolLayout1.infoShow.UnitY = tipYunit;
ReDrawRuler();
}
public void UpdataDataAndState(int index, int width)
{
longStrip_1.UpdataDataAndState(index, width);
}
}
}