private void RotateRight() { timer1.Enabled = false; g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); MyCartogram.RotateCartogram(1); MyCartogram.RePaintAll(checkBox1.Checked); MyCartogram.DrawAllAxis(); MyCartogram.DrawGrid(NextTvs); timer1.Enabled = true; }
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.Gray); NextTvs = this.MyCartogram.MynextTVS; this.MyCartogram.InitComponentsAfterDeserialize(this.g, this.pictureBox1, this.myPen); this.MyCartogram.RePaintAll(checkBox1.Checked); MyCartogram.DrawAllAxis(); MyCartogram.DrawGrid(NextTvs); SetNewSuCord(); ReDrawSU(); }
/// <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.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(); 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); } } //Существует файл с предысторией работы }