Пример #1
0
        static void Main(string[] args)
        {
            MyCanvas.CreateNewButton(1, 8, 10, 12);
            MyCanvas.CreateNewButton(1, 6, 20, 10);
            MyCanvas.CreateNewButton(1, 11, 30, 12);

            MyCanvas.Print();

            Console.WriteLine("\nMoveButton(0, 0, 7)");
            MyCanvas.MoveButton(0, 0, 7);
            MyCanvas.Print();

            Console.WriteLine("\nThe Max Width Of A Button is " + MyCanvas.GetTheMaxWidthOfAButton());
            Console.WriteLine("\nThe Max Height Of A Button is " + MyCanvas.GetTheMaxHeightOfAButton());
            Console.WriteLine("\nCurrent Number Of Buttons " + MyCanvas.GetCurrentNumberOfButtons());
            Console.WriteLine("\nIs Point Inside A Button? " + MyCanvas.IsPointInsideAButton(200, 200));
            Console.WriteLine("\nIs Point Inside A Button? " + MyCanvas.IsPointInsideAButton(1, 7));

            Console.WriteLine("\nDeleteLastButton()");
            MyCanvas.DeleteLastButton();
            MyCanvas.Print();

            Console.WriteLine("\nClearAllButtons()");
            MyCanvas.ClearAllButtons();
            Console.WriteLine("Current Number Of Buttons: " + MyCanvas.GetCurrentNumberOfButtons());
        }
Пример #2
0
        static void Main(string[] args)
        {
            MyCanvas myCanvas = new MyCanvas();

            //created buttons
            MyCanvas.CreateNewButton(0, 0, 100, 100);
            MyCanvas.CreateNewButton(100, 100, 200, 200);
            MyCanvas.CreateNewButton(200, 200, 300, 300);


            //moved button
            MyCanvas.MoveButton(0, 250, 250, 300, 400);

            //print
            Console.WriteLine(myCanvas.ToString());


            //fetch data
            Console.WriteLine($"Current Number Of Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            Console.WriteLine($"Max Number Of Buttons: {MyCanvas.GetMaxNumberOfButtons()}");
            Console.WriteLine($"Max Width Of A Button: {MyCanvas.GetTheMaxWidthOfAButton()}");
            Console.WriteLine($"Max Height Of A Button: {MyCanvas.GetTheMaxHeightOfAButton()}");

            //check if
            Console.WriteLine($"Is Point Inside A Button: {MyCanvas.IsPointInsideAButton(120,120)}");
            Console.WriteLine($"If any buttons is overlapping: {MyCanvas.CheckIfAnyButtonIsOverlapping()}");

            //delete last button
            MyCanvas.DeleteLastButton();
            Console.WriteLine(myCanvas.ToString());

            //clear all buttons
            MyCanvas.ClearAllButtons();
            Console.WriteLine(myCanvas.ToString());
        }
Пример #3
0
 static void Main(string[] args)
 {
     MyCanvas.CreateNewButton(0, 600, 800, 0);
     MyCanvas.CreateNewButton(500, 500, 700, 300);
     MyCanvas.CreateNewButton(300, 200, 400, 100);
     MyCanvas.MoveButton(1, 50, 50);
     MyCanvas.Print();
     Console.WriteLine(MyCanvas.GetCurrentNumberOfButton());
     Console.WriteLine(MyCanvas.GetMaxNumberOfButtons());
     Console.WriteLine(MyCanvas.GetTheMaxHeightOfAButton());
     Console.WriteLine(MyCanvas.GetTheMaxWidthOfAButton());
     Console.WriteLine(MyCanvas.IsPointInsideAButton(400, 400));
     Console.WriteLine(MyCanvas.CheckIfAnyButtonIsOverlapping());
     //Console.WriteLine(MyCanvas.DeleteLastButton());
     //פתרתי את זה בדרך הפשוטה, לכן אני לא רוצה להשתמש הפונקצייה הזאת, כי היא נחותה :)
     //Console.WriteLine(MyCanvas.GetCurrentNumberOfButton());
     //כנ"ל זאתי
     Console.ReadLine();
 }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine($"1. Button 1 created: {MyCanvas.CreateNewButton(3, 3, 6, 6)}");
            Console.WriteLine($"2. Button 2 created: {MyCanvas.CreateNewButton(8, 8, 15, 15)}");
            Console.WriteLine($"3. Button 3 created: {MyCanvas.CreateNewButton(30, 30, 60, 60)}");
            Console.ReadKey();

            MyCanvas.MoveButton(2, 6, 6);
            Console.WriteLine($"Current Number Of existing Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            bool deleteLast = MyCanvas.DeleteLastButton();

            Console.WriteLine($"Last delete Succeed {deleteLast}");
            Console.WriteLine($"Current Number Of existing Buttons: {MyCanvas.GetCurrentNumberOfButtons()}");
            Console.WriteLine($"MaxNumberOfButtons: {MyCanvas.GetMaxNumberOfButtons()}");
            Console.WriteLine($"MaxWidthOfAButton: {MyCanvas.GetTheMaxWidthOfAButton()}");
            Console.WriteLine($"MaxHeightOfAButton: {MyCanvas.GetTheMaxHeightOfAButton()}");
            Console.WriteLine($"Checking if the Point x= 10, y = 15 inside a button: {MyCanvas.IsPointInsideAButton(10, 15)}");
            Console.WriteLine($"AnyButtonIsOverlapping: { MyCanvas.CheckIfAnyButtonIsOverlapping()}");
            Console.ReadKey();
        }