private void загрузитьПоследнееСостояниеToolStripMenuItem_Click(object sender, EventArgs e) { BinaryFormatter binFormat = new BinaryFormatter(); Stream fStream = File.OpenRead("currstateCartogram.bin"); // JamesBondClass carFromDisk = //(JamesBondClass)binFormat.Deserialize(fStream); this.MyCartogram = (Cartogram)binFormat.Deserialize(fStream); fStream.Close(); this.g.Clear(Color.WhiteSmoke); NextTvs = this.MyCartogram.MynextTVS; this.MyCartogram.InitComponentsAfterDeserialize(this.g, this.pictureBox1, this.myPen); this.MyCartogram.RePaintAll(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked); // MyCartogram.DrawAllAxis(); if (checkBox4.Checked) { MyCartogram.DrawGrid(this.NextTvs); } SetNewSuCord(); ReDrawSU(); }
public void ReDraw(Graphics g, int screanState, int PicWidth, Cartogram mycart) { switch (screanState) { //Закоментено то что было для В-320 //case 0: // this._cord = new Point((int)(PicWidth - 0.04 * PicWidth), (int)(PicWidth * 0.2)); // break; //case 1: // this._cord = new Point((int)(PicWidth - PicWidth * 0.2), (int)(PicWidth - 0.09 * PicWidth)); // break; //case 2: // this._cord = new Point(0, (int)(PicWidth - PicWidth * 0.2)); // break; //case 3: // this._cord = new Point((int)(PicWidth * 0.2), 0); // break; //default: // break; case 0: // this._cordSKP2 = new Point((int)(0.04 * PicWidth), (int)(PicWidth * 0.5)); ///КООРДИНАТЫ SKP1 определены правильно this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y; //this._cordSKP2.X = mycart.getTVSByTVS360Number(88).Hex[2].X-((int)mycart.getFstep()/2); //this._cordSKP2.Y = mycart.getTVSByTVS360Number(88).Hex[2].Y + ((int)mycart.getFstep() / 2); // this._cordSKP2.X = this. break; case 1: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y + mycart.getFstep() * 2; //this._cordSKP2 = new Point((int)(PicWidth - PicWidth * 0.2), 0); break; case 2: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y; //this._cordSKP2 = new Point((int)(PicWidth * 0.9), (int)(PicWidth * 0.8)); break; ///По всей видимости на НВАЭС-2 эта будет основной режим. case 3: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y - mycart.getFstep() * 2; //this._cordSKP2 = new Point((int)(PicWidth * 0.2), (int)(PicWidth * 0.88)); break; default: break; } //g.DrawImage(this.mySKP1, this._cordSKP1); // g.DrawImage(this.mySKP2, this._cordSKP2); g.FillEllipse(MyConst.SKP1Brush, this._cordSKP1.X - MyConst.SKPsize, this._cordSKP1.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP2Brush, this._cordSKP2.X - MyConst.SKPsize, this._cordSKP2.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP3Brush, this._cordSKP3.X - MyConst.SKPsize, this._cordSKP3.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP4Brush, this._cordSKP4.X - MyConst.SKPsize, this._cordSKP4.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP5Brush, this._cordSKP5.X - MyConst.SKPsize, this._cordSKP5.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP6Brush, this._cordSKP6.X - MyConst.SKPsize, this._cordSKP6.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); }
private void Form1_Load(object sender, EventArgs e) { button1.BackColor = Color.CadetBlue; button3.BackColor = Color.DarkOrange; this.MaximizeBox = false; //this.MinimizeBox = false; pictureBox1.Dock = DockStyle.Fill; ////Этой хренькой я рисую границы ТВСок....Черной хренькой myPen = new System.Drawing.Pen(System.Drawing.Color.Black); myPen.Width = 4; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); g = Graphics.FromImage(myBitmap); MyCartogram = new Cartogram(g, pictureBox1, myPen); pictureBox1.Image = myBitmap; LinearGradientBrush lgbfon = new LinearGradientBrush( new Point(0, 0), new Point(pictureBox1.Width, pictureBox1.Height), Color.White, Color.Silver); g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); LinearGradientBrush lgb = new LinearGradientBrush( new Point(0, 0), new Point(1500, 0), Color.White, Color.Blue); // LinearGradientBrush lgb = new LinearGradientBrush() /// g.FillRectangle(lgb, this.ClientRectangle); // g.FillRectangle(Brushes.RoyalBlue, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //ЗАКРАСКА ФОНОМ БАССЕЙНА g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); LinearGradientBrush lgbdri = new LinearGradientBrush( new Point(0, 0), new Point(100, 0), Color.White, Color.Chocolate); //СТОЛ ДРИ g.FillRectangle(lgbdri, (int)(0.85 * this.pictureBox1.Width), (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); g.DrawString("ДРИ", myF, Brushes.Black, (int)(0.86 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = new SolidBrush(Color.Chocolate); //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); //MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawGrid(); MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); timer1.Enabled = true; ///ЛОГГЕР ОШИБОЧНО ЗАГРУЖЕННЫХ ТВС /// }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { toolTip1.SetToolTip(button2, "Поворот по часовой"); toolTip1.SetToolTip(button3, "Поворот против часовой"); pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; button4.Left = (tableLayoutPanel3.Width - button4.Width) / 2; tabPage1.BackColor = Color.Gray; button1.BackColor = Color.CadetBlue; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); pictureBox1.Image = myBitmap; g = Graphics.FromImage(myBitmap); myPen = new System.Drawing.Pen(Color.ForestGreen); myPen.Width = 2; MyCartogram = new Cartogram(g, pictureBox1, myPen); g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); //LinearGradientBrush lgbfon = new LinearGradientBrush( // new Point(0, 0), // new Point(pictureBox1.Width, pictureBox1.Height), // Color.White, // Color.Silver); //g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); ///для бассейна /// LinearGradientBrush lgb = new LinearGradientBrush( new Point(0, 0), new Point(1500, 0), Color.White, Color.Blue); //ЗАКРАСКА ФОНОМ БАССЕЙНА // g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); //g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); // LinearGradientBrush lgbdri = new LinearGradientBrush( // new Point((int)(0.95 * this.pictureBox1.Width), 0), // new Point(this.pictureBox1.Width, 0), // Color.White, // Color.Chocolate); // //СТОЛ ДРИ // g.FillRectangle(lgbdri, (int)(0.95 * this.pictureBox1.Width)+1, (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); ////g.DrawString(`) // Font myF1 = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 10, FontStyle.Bold); // g.DrawString("ДРИ", myF1, Brushes.Black, (int)(0.95 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = new SolidBrush(Color.Chocolate); //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawGrid(NextTvs); //MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; // label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); timer1.Enabled = true; // timer2.Enabled = true; //for (int i = 0; i < 20; i++) //{ // RotateRight(); // Thread.Sleep(100); //} //for (int i = 0; i < 20; i++) //{ // RotateLeft(); // Thread.Sleep(100); //} //MessageBox.Show(MyCartogram.getFA().ToString()); //MessageBox.Show(MyCartogram.getFstep().ToString()); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { // toolTip1.SetToolTip(button2, "Поворот по часовой"); // toolTip1.SetToolTip(button3, "Поворот против часовой"); pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; // button4.Left = (tableLayoutPanel3.Width - button4.Width) / 2; tabPage1.BackColor = Color.Gray; button1.BackColor = Color.CadetBlue; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); pictureBox1.Image = myBitmap; g = Graphics.FromImage(myBitmap); myPen = new System.Drawing.Pen(Color.ForestGreen); myPen.Width = 2; MyCartogram = new Cartogram(g, pictureBox1, myPen); g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); //LinearGradientBrush lgbfon = new LinearGradientBrush( // new Point(0, 0), // new Point(pictureBox1.Width, pictureBox1.Height), // Color.White, // Color.Silver); //g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); ///для бассейна /// //LinearGradientBrush lgb = new LinearGradientBrush( // new Point(0, 0), // new Point(1500, 0), // Color.White, // Color.Blue); //ЗАКРАСКА ФОНОМ БАССЕЙНА // g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); //g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); // LinearGradientBrush lgbdri = new LinearGradientBrush( // new Point((int)(0.95 * this.pictureBox1.Width), 0), // new Point(this.pictureBox1.Width, 0), // Color.White, // Color.Chocolate); // //СТОЛ ДРИ // g.FillRectangle(lgbdri, (int)(0.95 * this.pictureBox1.Width)+1, (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); ////g.DrawString(`) // Font myF1 = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 10, FontStyle.Bold); // g.DrawString("ДРИ", myF1, Brushes.Black, (int)(0.95 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = Color.Chocolate; //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); //отсортированные все ТВС в колекции по порядковому номеру загрузки MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawAllAxis(); MyCartogram.DrawGrid(NextTvs); //MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; // label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); // timer2.Enabled = true; //for (int i = 0; i < 20; i++) //{ // RotateRight(); // Thread.Sleep(100); //} //for (int i = 0; i < 20; i++) //{ // RotateLeft(); // Thread.Sleep(100); //} ///ЭТО ЧИСТО ДЛЯ ВЫБОРА ЯЧЕЙКИ ГДЕ БУДЕТ СИГНАЛИЗАТОР comboBox1.Items.Clear(); foreach (Point item in MyConst.setka) { comboBox1.Items.Add(item); } comboBox1.SelectedIndex = 0; // RotateRight(); RotateLeft(); timer1.Enabled = true; if (File.Exists("currstateCartogram.bin")) { string message = "Обнаружен файл с предысторией. Восстановить состяние (ДА) или начать новое (НЕТ) ?"; const string caption = "Внимание!"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.Yes) { загрузитьПоследнееСостояниеToolStripMenuItem_Click(this, EventArgs.Empty); } } //Существует файл с предысторией работы }
public void ReDraw(Graphics g, int screanState, int PicWidth, Cartogram mycart) { switch (screanState) { //Закоментено то что было для В-320 //case 0: // this._cord = new Point((int)(PicWidth - 0.04 * PicWidth), (int)(PicWidth * 0.2)); // break; //case 1: // this._cord = new Point((int)(PicWidth - PicWidth * 0.2), (int)(PicWidth - 0.09 * PicWidth)); // break; //case 2: // this._cord = new Point(0, (int)(PicWidth - PicWidth * 0.2)); // break; //case 3: // this._cord = new Point((int)(PicWidth * 0.2), 0); // break; //default: // break; case 0: // this._cordSKP2 = new Point((int)(0.04 * PicWidth), (int)(PicWidth * 0.5)); ///КООРДИНАТЫ SKP1 определены правильно this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y; this._cordAFP16.X = mycart.getTVSByTVS360Number(14).CanvasCord.X; this._cordAFP16.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y + (int)(mycart.getFstep() * 2.5); this._cordAFP8.X = mycart.getTVSByTVS360Number(149).CanvasCord.X; this._cordAFP8.Y = mycart.getTVSByTVS360Number(149).CanvasCord.Y - (int)(mycart.getFstep() * 3.3); this._cordDI14.X = mycart.getTVSByTVS360Number(14).CanvasCord.X + (int)(mycart.getFstep() * 3); this._cordDI14.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y; this._cordDI10.X = mycart.getTVSByTVS360Number(156).CanvasCord.X + (int)(mycart.getFstep() * 3); this._cordDI10.Y = mycart.getTVSByTVS360Number(156).CanvasCord.Y; this._cordDI12.X = mycart.getTVSByTVS360Number(101).CanvasCord.X + (int)(mycart.getFstep() * 2.3); this._cordDI12.Y = mycart.getTVSByTVS360Number(101).CanvasCord.Y; //this._cordSKP2.X = mycart.getTVSByTVS360Number(88).Hex[2].X-((int)mycart.getFstep()/2); //this._cordSKP2.Y = mycart.getTVSByTVS360Number(88).Hex[2].Y + ((int)mycart.getFstep() / 2); // this._cordSKP2.X = this. break; case 1: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y + mycart.getFstep() * 2; this._cordAFP16.X = mycart.getTVSByTVS360Number(14).CanvasCord.X - (int)(mycart.getFstep() * 2.5); this._cordAFP16.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y; this._cordAFP8.X = mycart.getTVSByTVS360Number(149).CanvasCord.X + (int)(mycart.getFstep() * 3.3); this._cordAFP8.Y = mycart.getTVSByTVS360Number(149).CanvasCord.Y; this._cordDI14.X = mycart.getTVSByTVS360Number(14).CanvasCord.X; this._cordDI14.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y + (int)(mycart.getFstep() * 3); this._cordDI10.X = mycart.getTVSByTVS360Number(156).CanvasCord.X; this._cordDI10.Y = mycart.getTVSByTVS360Number(156).CanvasCord.Y + (int)(mycart.getFstep() * 3); this._cordDI12.X = mycart.getTVSByTVS360Number(101).CanvasCord.X; this._cordDI12.Y = mycart.getTVSByTVS360Number(101).CanvasCord.Y + (int)(mycart.getFstep() * 2.3); //this._cordSKP2 = new Point((int)(PicWidth - PicWidth * 0.2), 0); break; case 2: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X + mycart.getFstep() * 2; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X - mycart.getFstep() * 2; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y; this._cordAFP16.X = mycart.getTVSByTVS360Number(14).CanvasCord.X; this._cordAFP16.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y - (int)(mycart.getFstep() * 2.5); this._cordAFP8.X = mycart.getTVSByTVS360Number(149).CanvasCord.X; this._cordAFP8.Y = mycart.getTVSByTVS360Number(149).CanvasCord.Y + (int)(mycart.getFstep() * 3.3); this._cordDI14.X = mycart.getTVSByTVS360Number(14).CanvasCord.X - (int)(mycart.getFstep() * 3); this._cordDI14.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y; this._cordDI10.X = mycart.getTVSByTVS360Number(156).CanvasCord.X - (int)(mycart.getFstep() * 3); this._cordDI10.Y = mycart.getTVSByTVS360Number(156).CanvasCord.Y; this._cordDI12.X = mycart.getTVSByTVS360Number(101).CanvasCord.X - (int)(mycart.getFstep() * 2.3); this._cordDI12.Y = mycart.getTVSByTVS360Number(101).CanvasCord.Y; //this._cordSKP2 = new Point((int)(PicWidth * 0.9), (int)(PicWidth * 0.8)); break; ///По всей видимости на НВАЭС-2 эта будет основной режим. case 3: this._cordSKP1.X = mycart.getTVSByTVS360Number(0).CanvasCord.X; this._cordSKP1.Y = mycart.getTVSByTVS360Number(0).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP2.X = mycart.getTVSByTVS360Number(75).CanvasCord.X; this._cordSKP2.Y = mycart.getTVSByTVS360Number(75).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP3.X = mycart.getTVSByTVS360Number(157).CanvasCord.X; this._cordSKP3.Y = mycart.getTVSByTVS360Number(157).CanvasCord.Y + mycart.getFstep() * 2; this._cordSKP4.X = mycart.getTVSByTVS360Number(162).CanvasCord.X; this._cordSKP4.Y = mycart.getTVSByTVS360Number(162).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP5.X = mycart.getTVSByTVS360Number(87).CanvasCord.X; this._cordSKP5.Y = mycart.getTVSByTVS360Number(87).CanvasCord.Y - mycart.getFstep() * 2; this._cordSKP6.X = mycart.getTVSByTVS360Number(5).CanvasCord.X; this._cordSKP6.Y = mycart.getTVSByTVS360Number(5).CanvasCord.Y - mycart.getFstep() * 2; this._cordAFP16.X = mycart.getTVSByTVS360Number(14).CanvasCord.X + (int)(mycart.getFstep() * 2.5); this._cordAFP16.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y; this._cordAFP8.X = mycart.getTVSByTVS360Number(149).CanvasCord.X - (int)(mycart.getFstep() * 3.3); this._cordAFP8.Y = mycart.getTVSByTVS360Number(149).CanvasCord.Y; this._cordDI14.X = mycart.getTVSByTVS360Number(14).CanvasCord.X; this._cordDI14.Y = mycart.getTVSByTVS360Number(14).CanvasCord.Y - (int)(mycart.getFstep() * 3); this._cordDI10.X = mycart.getTVSByTVS360Number(156).CanvasCord.X; this._cordDI10.Y = mycart.getTVSByTVS360Number(156).CanvasCord.Y - (int)(mycart.getFstep() * 3); this._cordDI12.X = mycart.getTVSByTVS360Number(101).CanvasCord.X; this._cordDI12.Y = mycart.getTVSByTVS360Number(101).CanvasCord.Y - (int)(mycart.getFstep() * 2.3); //this._cordSKP2 = new Point((int)(PicWidth * 0.2), (int)(PicWidth * 0.88)); break; default: break; } //g.DrawImage(this.mySKP1, this._cordSKP1); // g.DrawImage(this.mySKP2, this._cordSKP2); Pen mySKPPen = new Pen(Brushes.Red); Pen myAFPPen = new Pen(Brushes.Blue); Pen myDIPen = new Pen(Brushes.Black); g.FillEllipse(MyConst.SKP1Brush, this._cordSKP1.X - MyConst.SKPsize, this._cordSKP1.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP2Brush, this._cordSKP2.X - MyConst.SKPsize, this._cordSKP2.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP3Brush, this._cordSKP3.X - MyConst.SKPsize, this._cordSKP3.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP4Brush, this._cordSKP4.X - MyConst.SKPsize, this._cordSKP4.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP5Brush, this._cordSKP5.X - MyConst.SKPsize, this._cordSKP5.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.SKP6Brush, this._cordSKP6.X - MyConst.SKPsize, this._cordSKP6.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP1.X - MyConst.SKPsize, this._cordSKP1.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP2.X - MyConst.SKPsize, this._cordSKP2.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP3.X - MyConst.SKPsize, this._cordSKP3.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP4.X - MyConst.SKPsize, this._cordSKP4.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP5.X - MyConst.SKPsize, this._cordSKP5.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.DrawEllipse(mySKPPen, this._cordSKP6.X - MyConst.SKPsize, this._cordSKP6.Y - MyConst.SKPsize, MyConst.SKPsize * 2, MyConst.SKPsize * 2); g.FillEllipse(MyConst.AFP16Brush, this._cordAFP16.X - MyConst.AFPsize, this._cordAFP16.Y - MyConst.AFPsize, MyConst.AFPsize * 2, MyConst.AFPsize * 2); g.DrawEllipse(myAFPPen, this._cordAFP16.X - MyConst.AFPsize, this._cordAFP16.Y - MyConst.AFPsize, MyConst.AFPsize * 2, MyConst.AFPsize * 2); g.FillEllipse(MyConst.AFP8Brush, this._cordAFP8.X - MyConst.AFPsize, this._cordAFP8.Y - MyConst.AFPsize, MyConst.AFPsize * 2, MyConst.AFPsize * 2); g.DrawEllipse(myAFPPen, this._cordAFP8.X - MyConst.AFPsize, this._cordAFP8.Y - MyConst.AFPsize, MyConst.AFPsize * 2, MyConst.AFPsize * 2); g.FillEllipse(MyConst.DI14Brush, this._cordDI14.X - MyConst.DIsize, this._cordDI14.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); g.DrawEllipse(myDIPen, this._cordDI14.X - MyConst.DIsize, this._cordDI14.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); g.FillEllipse(MyConst.DI12Brush, this._cordDI12.X - MyConst.DIsize, this._cordDI12.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); g.DrawEllipse(myDIPen, this._cordDI12.X - MyConst.DIsize, this._cordDI12.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); g.FillEllipse(MyConst.DI10Brush, this._cordDI10.X - MyConst.DIsize, this._cordDI10.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); g.DrawEllipse(myDIPen, this._cordDI10.X - MyConst.DIsize, this._cordDI10.Y - MyConst.DIsize, MyConst.DIsize * 2, MyConst.DIsize * 2); Pen myDefaultPen = new Pen(Brushes.White); myDefaultPen.DashStyle = DashStyle.Dash; myDefaultPen.DashCap = DashCap.Triangle; myDefaultPen.Width = 1; // g.DrawEllipse(Pens.LightGray, 7, 7, PicWidth - 14, PicWidth - 14); // g.DrawPie(Pens.LightGray, 7, 7, PicWidth - 14, PicWidth - 14,0,270); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { // Bitmap OnePicture = new Bitmap("D:\\Загрузка ред 02\\Безымянный.png"); // ImageList imageList1 = new ImageList(); // imageList1.Images.Add(OnePicture); button4.BackColor = Color.Transparent; //прозрачный цвет фона // button4.BackgroundImage = imageList1.Images[0]; // button4.BackgroundImageLayout = ImageLayout.Center; //выравниваем её по центру button4.FlatStyle = FlatStyle.Flat; // button4.Text = "АФП"; button4.TextAlign = ContentAlignment.TopCenter; //позиция текста - внизу по центру button4.FlatAppearance.BorderSize = 0; //ширина рамки = 0 // button4.TextImageRelation = TextImageRelation.ImageAboveText; //картинка над текстом button4.TabStop = false; //делаем так, что бы при потере фокуса, вокруг кнопки не оставалась черная рамка button5.BackColor = Color.Transparent; //прозрачный цвет фона button5.FlatStyle = FlatStyle.Flat; button5.TextAlign = ContentAlignment.TopCenter; //позиция текста - внизу по центру button5.FlatAppearance.BorderSize = 0; //ширина рамки = 0 button5.TabStop = false; //делаем так, что бы при потере фокуса, вокруг кнопки не оставалась черная рамка button6.BackColor = Color.Transparent; //прозрачный цвет фона button6.FlatStyle = FlatStyle.Flat; button6.TextAlign = ContentAlignment.TopCenter; //позиция текста - внизу по центру button6.FlatAppearance.BorderSize = 0; //ширина рамки = 0 button6.TabStop = false; //делае // button2.BackColor = Color.Transparent; //прозрачный цвет фона // // button4.BackgroundImage = imageList1.Images[0]; // // button4.BackgroundImageLayout = ImageLayout.Center; //выравниваем её по центру // button2.FlatStyle = FlatStyle.Flat; //// button4.Text = "АФП"; //// button4.TextAlign = ContentAlignment.TopCenter; //позиция текста - внизу по центру // button2.FlatAppearance.BorderSize = 0;//ширина рамки = 0 // // button4.TextImageRelation = TextImageRelation.ImageAboveText; //картинка над текстом // button2.TabStop = false; //// button2.BackColor = Color.Transparent; toolTip1.SetToolTip(button2, "Поворот по часовой"); toolTip1.SetToolTip(button3, "Поворот против часовой"); pictureBox1.Height = Math.Min(pictureBox1.Parent.Width, pictureBox1.Parent.Height); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (pictureBox1.Parent.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; // pictureBox1.z // button4.Left = (tableLayoutPanel3.Width - button4.Width) / 2; pictureBox1.Parent.BackColor = MyConst.MyBackground; pictureBox1.BackColor = MyConst.MyBackground; pictureBox2.BackColor = MyConst.MyBackground; tableLayoutPanel1.BackColor = MyConst.MyBackground; tableLayoutPanel2.BackColor = MyConst.MyBackground; tableLayoutPanel3.BackColor = MyConst.MyBackground; //tableLayoutPanel4.BackColor = MyConst.MyBackground; //tableLayoutPanel5.BackColor = MyConst.MyBackground; button1.BackColor = Color.DarkBlue; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); pictureBox1.Image = myBitmap; g = Graphics.FromImage(myBitmap); myPen = new System.Drawing.Pen(Color.Blue); myPen.Width = 2; MyCartogram = new Cartogram(g, pictureBox1, myPen); g.FillRectangle(Brushes.WhiteSmoke, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); //LinearGradientBrush lgbfon = new LinearGradientBrush( // new Point(0, 0), // new Point(pictureBox1.Width, pictureBox1.Height), // Color.White, // Color.Silver); //g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); ///для бассейна /// //LinearGradientBrush lgb = new LinearGradientBrush( // new Point(0, 0), // new Point(1500, 0), // Color.White, // Color.Blue); //ЗАКРАСКА ФОНОМ БАССЕЙНА // g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); //g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); // LinearGradientBrush lgbdri = new LinearGradientBrush( // new Point((int)(0.95 * this.pictureBox1.Width), 0), // new Point(this.pictureBox1.Width, 0), // Color.White, // Color.Chocolate); // //СТОЛ ДРИ // g.FillRectangle(lgbdri, (int)(0.95 * this.pictureBox1.Width)+1, (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); ////g.DrawString(`) // Font myF1 = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 10, FontStyle.Bold); // g.DrawString("ДРИ", myF1, Brushes.Black, (int)(0.95 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = Color.Chocolate; //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); //MyCartogram.Show(); //MyCartogram.UpdateLoadNumber(checkBox1.Checked); MyCartogram.CalcCord(pictureBox1.Width); MyCartogram.RePaintAll(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked); // //отсортированные все ТВС в колекции по порядковому номеру загрузки MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); // MyCartogram.DrawAllAxis(); // MyCartogram.DrawGrid(NextTvs); //MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; // label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); //timer2.Enabled = true; //for (int i = 0; i < 20; i++) //{ // RotateRight(); // Thread.Sleep(100); //} //for (int i = 0; i < 20; i++) //{ // RotateLeft(); // Thread.Sleep(100); //} ///ЭТО ЧИСТО ДЛЯ ВЫБОРА ЯЧЕЙКИ ГДЕ БУДЕТ СИГНАЛИЗАТОР //comboBox1.Items.Clear(); //foreach (Point item in MyConst.setka) //{ // comboBox1.Items.Add(item); //} //comboBox1.SelectedIndex = 0; RotateRight(); // RotateLeft(); timer1.Enabled = true; if (File.Exists("currstateCartogram.bin")) { //string message = // "Обнаружен файл с предысторией. Восстановить состяние (ДА) или начать новое (НЕТ) ?"; // const string caption = "Внимание!"; // var result = MessageBox.Show(message, caption, // MessageBoxButtons.YesNo, // MessageBoxIcon.Question); // // If the no button was pressed ... // if (result == DialogResult.Yes) // { // загрузитьПоследнееСостояниеToolStripMenuItem_Click(this, EventArgs.Empty); // } if (MyConst.Prodolzhit() == DialogResult.OK) { загрузитьПоследнееСостояниеToolStripMenuItem_Click(this, EventArgs.Empty); } } //Существует файл с предысторией работы }