Пример #1
0
        public BiddingBox(EventHandler eventHandler)
        {
            InitializeComponent();
            BiddingBoxClick += eventHandler;
            Left             = 50;
            Top              = 200;
            Name             = "BiddingBox";
            Size             = new Size(200, 210);

            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      = (4 - (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
                    };
                    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);
        }
Пример #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);
        }