Exemplo n.º 1
0
        //constructor
        public PipGraphic(BoardGraphic parentBoard, Pips SubjPips, bool inv, bool pen = false)
        {
            InitializeComponent();
            SprImage      = WhitePip;
            parent        = parentBoard;
            Subj          = SubjPips;
            Width         = SprImage.Width + 2;
            Height        = Limit * 50 + 2;
            Sprs          = new PictureBox[Limit];
            BackColor     = Color.Transparent;
            Selected      = false;
            this.Inverse  = inv;
            this.Penalize = pen;

            Indx            = new ToolTip();
            Indx.IsBalloon  = true;
            Indx.UseFading  = false;
            Indx.ShowAlways = true;

            for (int i = 0; i < Limit; i++)
            {
                Sprs[i]        = new PictureBox();
                Sprs[i].Width  = SprImage.Width;
                Sprs[i].Height = SprImage.Height;
                Sprs[i].Image  = SprImage;
                Sprs[i].SendToBack();
                Sprs[i].MouseEnter += new System.EventHandler(this.PipGraphic_MouseEnter);
                Sprs[i].MouseLeave += new System.EventHandler(this.PipGraphic_MouseLeave);
                Sprs[i].MouseClick += new System.Windows.Forms.MouseEventHandler(this.PipGraphic_MouseClick);

                Controls.Add(Sprs[i]);
                Sprs[i].Location = new Point(0, i * SprImage.Height);
            }

            FlowOver_Label      = new Label();
            FlowOver_Label.Font = new Font("AR JULIAN", 14, FontStyle.Regular);
            if (inv)
            {
                FlowOver_Label.Location = new Point(Location.X + Xoff, Location.Y + Yoff);
            }
            else
            {
                FlowOver_Label.Location = new Point(Location.X + Xoff, Location.Y + Height - Yoff * 2);
            }
            FlowOver_Label.Visible = false;
            Controls.Add(FlowOver_Label);
            UpdtView();
            BringToFront();
        }
Exemplo n.º 2
0
        private void NewGameButton_Click(object sender, EventArgs e)
        {
            if (Game != null)
            {
                if (Game.Begun)
                {
                    DialogResult dg = MessageBox.Show("Start New Game?", "New Game", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dg == DialogResult.No)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (graphic != null)
            {
                graphic.Dispose();
            }

            MainMenuForm MMF = new MainMenuForm();

            MMF.ShowDialog();
            Game = MMF.GetNewGame();

            Game.NewGame(this);
            graphic = new BoardGraphic(Game);

            Controls.Add(graphic);
            graphic.Location = new Point(10, 10);

            PointsPanel.Visible = true;
            DiceButton.Visible  = true;
            DiceLabel.Visible   = true;
            WaitingForDiceRoll();
        }