Esempio n. 1
0
        public void ShowGraph() // the function to show the state of the container, using different kinds of block
        {
            Graphics g = Main_Screen.CreateGraphics();

            g.DrawLine(new Pen(black), new PointF(0, 0), new PointF(0, 400));
            g.DrawLine(new Pen(black), new PointF(0, 0), new PointF(240, 0));
            g.DrawLine(new Pen(black), new PointF(0, 400), new PointF(240, 400));
            g.DrawLine(new Pen(black), new PointF(240, 0), new PointF(240, 400));
            for (int i = 1; i <= 20; i++)
            {
                for (int j = 1; j <= 12; j++)
                {
                    if (this.g.graph[i, j] == 0)
                    {
                        g.FillRectangle(white, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 1)
                    {
                        g.FillRectangle(black, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 2)
                    {
                        g.FillRectangle(red, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 3)
                    {
                        g.FillRectangle(orange, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 4)
                    {
                        g.FillRectangle(yellow, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 5)
                    {
                        g.FillRectangle(green, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 6)
                    {
                        g.FillRectangle(cyan, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 7)
                    {
                        g.FillRectangle(blue, Shape[i, j]);
                    }
                    else if (this.g.graph[i, j] == 8)
                    {
                        g.FillRectangle(purple, Shape[i, j]);
                    }
                }
            }
        }
Esempio n. 2
0
        // Constructor:
        internal Client_Control()
        {
            // Create main screen for the client:
            Application.SetCompatibleTextRenderingDefault(false);
            main_screen = new Main_Screen();

            // Create and add event handlers for main page:
            event_handlers_creator_and_adder = new Event_Handlers_Create_And_Add(this, main_screen);
            event_handlers_creator_and_adder.create_and_add_Event_Handlers(main_screen.Main_page);
            main_screen.Event_handler_added_to_main_page = true;

            // Create and display the form:
            Application.EnableVisualStyles();
            Application.Run(main_screen);
        }
Esempio n. 3
0
        }                                                           // the event of exit

        private void Start_Botton_Click(object sender, EventArgs e) // the event of start
        {
            if (Restart == true)
            {
                Start();
                Start_Botton.Text = "End";
            }
            else if (Restart == false)
            {
                End();
                Main_Screen.Refresh();
                Next_Block.Refresh();
                Start_Botton.Text = "Start";
                MessageBox.Show("Game Over!");
                pause            = false;
                Pause_Lable.Text = "Pause";
            }
        }
 internal Event_Handlers_Create_And_Add(Client_Control client_controller, Main_Screen main_screen)
 {
     this.client_controller = client_controller;
     this.main_screen       = main_screen;
 }