-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
211 lines (156 loc) · 5.23 KB
/
MainForm.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
using System;
using System.Collections.Generic;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
namespace GBusManager
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
Graphics g;
public Misc.Mode mode;
bool drawLine;
int x1,y1;
Point s,f;
ArrayList rs = new ArrayList();
public String crs = "";
int pn = 0;
int lpn = 0;
//Point[] pa;
public ArrayList points = new ArrayList(20);
//points;
public Point FindNear(int x, int y, int d){
for (int i = 0; i<points.Count; i++ ){
Point p = (Point)points[i];
if (p.X >= x-d && p.X <= x+d && p.Y >= y-d && p.Y <= y+d ){
return p;
}
}
return null;
}
public MainForm()
{
//Status.Routes = rs;
//Status.Points = points;
InitializeComponent();
ArrayList pal = new ArrayList();
points.Capacity = 30;
Status.tp = toolsPanel2;
Status.graphcreator = graphCreator1;
Status.crs = crs;
//graphCreator1.Enabled = false;
}
void MainFormLoad(object sender, EventArgs e)
{
toolsPanel2.graphcreator = graphCreator1;
Settings1 set = new Settings1();
//set.AdditionalEdgeEllipsis
//graphCreator1.DrawPoint(new Point(100, 100, 1));
graphCreator1.MyEvent += new MyEventHandler(graphCreator1_MyEvent);
}
void graphCreator1_MyEvent(object sender, MyEventArgs e)
{
label1.Text = String.Format("{0},{1}", e.X, e.Y);
}
void Button4Click(object sender, EventArgs e)
{
rs.Add(crs);
crs = "";
}
void Button5Click(object sender, EventArgs e)
{
g.Clear(Color.White);
}
private void graphViewer1_Load(object sender, EventArgs e)
{
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
Status.ElEd = ((CheckBox)sender).Checked;
}
private void graphCreator1_Scroll(object sender, ScrollEventArgs e)
{
//toolsPanel2.RoutesListBox.SelectedIndex = toolsPanel2.RoutesListBox.SelectedIndex + e.
MessageBox.Show((e.NewValue - e.OldValue).ToString());
}
void graphCreator1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
try
{
for (int i = 0; i < toolsPanel2.RoutesListBox.Items.Count; i++)
{
if (e.Delta < 0)
toolsPanel2.RoutesListBox.SelectedItems[i] = toolsPanel2.RoutesListBox.Items[toolsPanel2.RoutesListBox.SelectedItems.IndexOf(toolsPanel2.RoutesListBox.SelectedItems[i]) - 1];
else
toolsPanel2.RoutesListBox.SelectedItems[i] = toolsPanel2.RoutesListBox.Items[toolsPanel2.RoutesListBox.SelectedItems.IndexOf(toolsPanel2.RoutesListBox.SelectedItems[i]) + 1];
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
}
private void graphCreator1_Load(object sender, EventArgs e)
{
}
private void graphCreator1_Paint(object sender, PaintEventArgs e)
{
//sender
}
private void настройкиToolStripMenuItem_Click(object sender, EventArgs e)
{
SettingsForm sf = new SettingsForm();
sf.ShowDialog();
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveLoad.Save();
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveLoad.Load();
//graphCreator1 = new GraphCreator();
//graphCreator1.Invalidate();
//graphCreator1;
toolsPanel2.RefreshRoutesAndPoints();
//Controls.Remove(graphCreator1);
//graphCreator1 = new GraphCreator();
//Controls.Add(graphCreator1);
graphCreator1.points = Status.Points;
Status.tp.routes = Status.Routes;
//graphCreator1.Redraw(true);
}
private void toolsPanel2_Load(object sender, EventArgs e)
{
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Console.WriteLine("Need to save data");
SaveLoad.Save();
}
private void toolStripStatusLabel2_Click(object sender, EventArgs e)
{
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void очиститьToolStripMenuItem_Click(object sender, EventArgs e)
{
Status.Routes.Clear();
Status.Points.Clear();
}
private void новыйToolStripMenuItem_Click(object sender, EventArgs e)
{
Status.Routes = new ArrayList();
Status.Points = new ArrayList();
graphCreator1.Enabled = true;
graphCreator1.points = Status.Points;
graphCreator1.Show();
//graphCreator1
}
}
}