示例#1
0
        private void tableLayoutPanel1_MouseClick(object sender, MouseEventArgs e)
        {
            int a;

            // MessageBox.Show("x:" + e.Location.X + "  y:" + e.Location.Y);
            if (Is_discard_selected == true)
            {
                Hand[] h = Solitaire_Game.get_tableauPiles();
                if (h[0].GetCount() == 0)
                {
                    num_shown_panel1 = 1;
                }
                if (Solitaire_Game.Move_Card(1) == true)
                {
                    Display7table(1);
                    Displaydiscard();
                }
                else
                {
                    MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                }
                Is_discard_selected = false;
            }
            else if ((a = Is_panel_selected()) > 0)
            {
                if (a != 1)
                {
                    if (Solitaire_Game.PanelToPanel(a, 1))
                    {
                        num_shown_panel1++;
                        reduce_num(a);
                    }
                    else
                    {
                        MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                    }
                    reset_is_select();
                    Display7table(a);
                    Display7table(1);
                }
                else
                {
                    MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                    reset_is_select();
                    Is_panel1_selected = true;
                }
            }
            else
            {
                reset_is_select();
                Is_panel1_selected = true;
            }
        }
示例#2
0
        private void tableLayoutPanel7_MouseClick(object sender, MouseEventArgs e)
        {
            int a;

            if (Is_discard_selected == true)
            {
                if (Solitaire_Game.Move_Card(7) == true)
                {
                    num_shown_panel7++;
                    Display7table(7);
                    Displaydiscard();
                }
                else
                {
                    MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                }
                Is_discard_selected = false;
            }
            else if ((a = Is_panel_selected()) > 0)
            {
                if (a != 7)
                {
                    if (Solitaire_Game.PanelToPanel(a, 7))
                    {
                        reduce_num(a);
                        num_shown_panel7++;
                    }
                    else

                    {
                        MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                    }
                    reset_is_select();
                    Display7table(a);
                    Display7table(7);
                }
                else
                {
                    MessageBox.Show("ERROP - Move not allowed - Cannot place card onto this card");
                    reset_is_select();
                    Is_panel7_selected = true;
                }
            }
            else
            {
                reset_is_select();
                Is_panel7_selected = true;
            }
        }