コード例 #1
0
        public Image UpdateBoard()
        {
            var boardOffOrig = (Image)Images.bingo_off.Clone();
            var boardOff     = Graphics.FromImage(boardOffOrig);
            var boardOn      = (Image)Images.bingo_on.Clone();

            foreach (var number in _parent.BingoBoard.NumbersShowing)
            {
                var pos = BingoBoard.GetPositionForNumber(number);

                boardOff.DrawImage(boardOn, new Rectangle(pos.X, pos.Y, BingoBoard.BoardNumberWidth - 10, BingoBoard.BoardNumberHeight), new Rectangle(pos.X, pos.Y, BingoBoard.BoardNumberWidth - 10, BingoBoard.BoardNumberHeight), GraphicsUnit.Pixel);
            }

            if (_parent.BingoBoard.NumbersShowing.Count > 0)
            {
                boardOff.TextRenderingHint = TextRenderingHint.AntiAlias;

                var left = _parent.BingoBoard.NumbersShowing.Count + "/" +
                           _parent.BingoBoard.GameType.GetLegalCategories().Count * 15;
                boardOff.DrawString(left, ArialSmall, Brushes.White, 30, 678);

                var num       = _parent.BingoBoard.CurrentNumber;
                var curNumStr = BingoBoard.LetterForNumber(num) + @"-" + num;
                boardOff.DrawString(curNumStr, Arial, Brushes.White,
                                    boardOffOrig.Width / 2f - boardOff.MeasureString(curNumStr, Arial).Width / 2f, 642);

                var name = _parent.BingoBoard.GameType.GetName();
                boardOff.DrawString(name, ArialSmall, Brushes.White, boardOffOrig.Width - 30 - boardOff.MeasureString(name, ArialSmall).Width, 678);
            }

            pictureBox1.Image = boardOffOrig;

            return(boardOffOrig);
        }
コード例 #2
0
        private void GetBoardBtn_Click(object sender, EventArgs e)
        {
            int labelX    = 260;
            int labelY    = 100;
            int labelXtmp = labelX;

            bingoBoard = new BingoBoard(1, 52, 5, 5);
            var boardNumbers = bingoBoard.GetBingoBoardNumbers();

            for (int i = 0; i < labels.GetLength(0); i++)
            {
                for (int j = 0; j < labels.GetLength(1); j++)
                {
                    labels[i, j] = AddLabel(boardNumbers[i, j].ToString(), labelX, labelY);

                    labelX += 70;
                }
                labelX  = labelXtmp;
                labelY += 70;
            }

            for (int i = 0; i < labels.GetLength(0); i++)
            {
                for (int j = 0; j < labels.GetLength(1); j++)
                {
                    Controls.Add(labels[i, j]);
                }
            }
            GetNumberBtn.Enabled = true;
            GetBoardBtn.Enabled  = false;
        }
コード例 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var ver = Assembly.GetExecutingAssembly().GetName().Version;

            Text         = Resources.BingoController + " v" + ver;
            lNumber.Text = Resources.Ready;

            BingoBoard = new BingoBoard();

            _display = new FormBingoDisplay(this);
            _display.Show();

            BingoBoard.GameType = GameTypes[0];

            for (var i = 0; i < GameTypes.Length; i++)
            {
                GameTypeNames[i] = GameTypes[i].GetName();
                cbGameSelector.Items.Add(GameTypeNames[i]);
            }
            cbGameSelector.SelectedIndex = 0;
        }