private void Form1_Resize(object sender, EventArgs e) { pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; if (g != null) { g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); int currentstate = MyCartogram.ScreanAngle1; ///изначально рисуем и расчитывает координаты в нулевой фазе MyCartogram.Show(); MyCartogram.ScreanAngle1 = 0; if (currentstate != 0) { int k = 0; while (k != currentstate) { RotateRight(); k++; } } else { MyCartogram.RePaintAll(checkBox1.Checked); MyCartogram.DrawGrid(NextTvs); SetNewSuCord(); ReDrawSU(); } } }
private void Form1_Resize(object sender, EventArgs e) { pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; if (g != null) { g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); int currentstate = MyCartogram.ScreanAngle1; MyCartogram.ScreanAngle1 = 0; MyCartogram.Show(); if (currentstate != 0) { int k = 0; while (k != currentstate) { RotateRight(); k++; } } else { MyCartogram.RePaintAll(checkBox1.Checked); //MyCartogram.UpdateLoadNumber(checkBox1.Checked); MyCartogram.DrawGrid(NextTvs); } } }
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); } } //Существует файл с предысторией работы }