Пример #1
0
 private void rectangle_DoubleClick(object sender, EventArgs e)
 {
     if (this.owner == 1)
     {
         this.Hide();
         GUI.rectangle r2 = new rectangle(this.Index, this.OriginalWidth, this.OriginalHeight, 2, this.editSolution);
         r2.Location = new System.Drawing.Point(0, 0);
         r2.Width = Convert.ToInt32(this.OriginalWidth * editSolution.factor);
         r2.Height = Convert.ToInt32(this.OriginalHeight * editSolution.factor);
         r2.Anchor = (AnchorStyles.None);
         r2.Owner = 2;
         r2.color = this.BackColor;
         r2.BackColor = Color.Red;
         editSolution.selectedRectangle = r2;
         editSolution.splitContainer1.Panel2.Controls.Add(r2);
         editSolution.rectangles.Add(r2);
         editSolution.updateColors();
     }
     //else
     //{
     //    foreach (Control c in editSolution.splitContainer1.Panel1.Controls)
     //       {
     //           if (c.GetType() == typeof(GUI.rectangle))
     //           {
     //               GUI.rectangle r = (GUI.rectangle)c;
     //               if (r.Index == this.Index)
     //               {
     //                   r.Show();
     //                   editSolution.rectangles.Remove(r);
     //                   editSolution.splitContainer1.Panel2.Controls.Remove(r);
     //               }
     //           }
     //      }
     //}
 }
Пример #2
0
        private void paintRectangles()
        {
            int index = 1;
            Color c;
            Label lab;
            GUI.rectangle r2;

            foreach (Data.Rectangle r in mainFrm.Engine.Rectangles)
            {
                r2 = new rectangle(index, r.Width, r.Height,1,this);
                r2.Width = Convert.ToInt32(r2.OriginalWidth * ratio);
                r2.Height = Convert.ToInt32(r2.OriginalHeight * ratio);

                c = drawBrush();
                r2.BackColor = c;
                r2.color = c;
                r2.Location = new System.Drawing.Point(10, uly);
                r2.Anchor = ((System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left));
                splitContainer1.Panel1.Controls.Add(r2);
                r2.OldUly = r2.Location.Y;

                lab = new Label();
                lab.Name = Convert.ToString(index);
                lab.Location = new System.Drawing.Point(SQR_SIZE+12, uly);
                lab.Text = "Nr. " + (index) + "\nSzeroko��: " + r.Width.ToString() + "\nWysoko��: " + r.Height.ToString() + "\nPole: " + Convert.ToString(r.Height*r.Width);
                lab.Anchor = ((System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left));
                lab.Height = 60;
                lab.Width = 100;

                splitContainer1.Panel1.Controls.Add(lab);
                //rectangles.Add(r2)
                index++;
                uly += SQR_SIZE +2;
            }
        }