private void button2_Click(object sender, EventArgs e)
        {
            /*정사각형 그리기*/
            Random random = new Random();
            int left = random.Next(130, 240);
            int top = random.Next(1, 150);
            int width = random.Next(10, 300);
            //int bottom = random.Next(200, 300);

            Square square = new Square(left, top, width);

            figures.Add(square);

            Form1_Paint(null, null);
        }
Example #2
0
 private void updateSquare(Square s, Point p, bool hasQ, bool hint)
 {
     if (hasQ)
     {
         s.setIsValid(false);
         s.addSource(p);
         if (hint)
         {
             s.setColor(Brushes.Red);
             s.setFontColor(Brushes.Black);
         }
     }
     else if (s.deleteSource(p) == 0)
     {
         s.setIsValid(true);
         if (hint)
         {
             s.setColor(s.getDefaultColor());
             s.setFontColor(s.getDefaultFontColor());
         }
     }
 }