示例#1
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());
        }
示例#2
0
 static void Main(string[] args)
 {
     Console.WriteLine(MyCanvas.CreateNewButton(2, 4, 6, 8));
     Console.WriteLine(MyCanvas.CreateNewButton(3, 5, 7, 9));
     Console.WriteLine(MyCanvas.CreateNewButton(1, 2, 3, 4));
     Console.WriteLine(MyCanvas.GetCurrentNumberOfButtons());
     Console.WriteLine(MyCanvas.GetMaxNumberOfButtons());
     Console.WriteLine(MyCanvas.GetMaxWidthOffAButton());
     Console.WriteLine(MyCanvas.GetMaxHeightOffAButtoon());
 }
示例#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();
        }