private void Form1_Resize(object sender, EventArgs e) { pictureBox1.Height = Math.Min(pictureBox1.Parent.Height, pictureBox1.Parent.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (pictureBox1.Parent.Height - 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.CalcCord(pictureBox1.Width); MyCartogram.RePaintAll(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked); MyCartogram.ScreanAngle1 = 0; if (currentstate != 0) { int k = 0; while (k != currentstate) { RotateRight(); k++; } } else { MyCartogram.RePaintAll(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked); if (checkBox4.Checked) { MyCartogram.DrawGrid(this.NextTvs); } SetNewSuCord(); ReDrawSU(); } } }
/// <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); } } //Существует файл с предысторией работы }