Exemple #1
0
        public BiddingBox(EventHandler eventHandler)
        {
            BiddingBoxClick += eventHandler;
            InitializeComponent();
            Name      = "BiddingBox";
            Size      = new Size(200, 183);
            BackColor = Color.White;

            foreach (Suit suit in Enum.GetValues(typeof(Suit)))
            {
                foreach (var level in Enumerable.Range(1, 7))
                {
                    var button = new BiddingBoxButton(new Bid(level, suit))
                    {
                        Width     = defaultButtonWidth,
                        Left      = ((int)suit) * defaultButtonWidth,
                        Top       = (level - 1) * defaultButtonHeight,
                        Parent    = this,
                        Text      = Convert.ToString(level) + Util.GetSuitDescription(suit),
                        ForeColor = suit == Suit.Diamonds || suit == Suit.Hearts ? Color.Red : Color.Black,
                        FlatStyle = FlatStyle.Flat
                    };
                    button.Click += BiddingBoxClick;
                    button.Show();
                    buttons.Add(button);
                }
            }

            AddButton(BidType.pass, 0, "pass", 100);
            AddButton(BidType.dbl, 100, "dbl", 40);
            AddButton(BidType.rdbl, 140, "rdbl", 60);
        }
Exemple #2
0
        private void AddButton(BidType bidType, int buttonLeft, string buttonText, int buttonWidth)
        {
            var button = new BiddingBoxButton(new Bid(bidType))
            {
                Width  = buttonWidth,
                Top    = defaultButtonHeight * 7,
                Left   = buttonLeft,
                Parent = this,
                Text   = buttonText
            };

            button.Click += BiddingBoxClick;
            button.Show();
            buttons.Add(button);
        }