コード例 #1
0
 private void GetPayoffButton()
 {
     foreach (PayoffWay payoff in ConstantValuePool.PayoffWayList)
     {
         CrystalButton btn = new CrystalButton();
         btn.Name      = payoff.PayoffID.ToString();
         btn.Text      = payoff.PayoffName;
         btn.Width     = m_Width;
         btn.Height    = m_Height;
         btn.BackColor = btn.DisplayColor = Color.Blue;
         btn.Font      = new Font("Microsoft YaHei", 12F, FontStyle.Regular);
         btn.ForeColor = Color.White;
         foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList)
         {
             if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID))
             {
                 float     emSize = (float)btnStyle.FontSize;
                 FontStyle style  = FontStyle.Regular;
                 btn.Font      = new Font(btnStyle.FontName, emSize, style);
                 btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor);
                 btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor);
                 break;
             }
         }
         btn.Tag    = payoff;
         btn.Click += new System.EventHandler(this.btnPayoff_Click);
         payoffButtonList.Add(btn);
     }
 }
コード例 #2
0
        private void BindPayoffWay()
        {
            this.pnlPayoffWay.Controls.Clear();
            //support six buttons
            int space = 5;
            int px = 0, py = 0;
            int width  = (pnlPayoffWay.Width - 2 * space) / 3;
            int height = (pnlPayoffWay.Height - space) / 2;
            List <PayoffWay> payoffWayList = new List <PayoffWay>();

            foreach (PayoffWay item in ConstantValuePool.PayoffWayList)
            {
                if (item.AsVIPCardPayWay)
                {
                    payoffWayList.Add(item);
                }
            }
            int pageSize = 0;

            if (payoffWayList.Count > 6)
            {
                pageSize = 6;
            }
            else
            {
                pageSize = payoffWayList.Count;
            }
            for (int index = 0; index < pageSize; index++)
            {
                PayoffWay     payoff = payoffWayList[index];
                CrystalButton btn    = new CrystalButton();
                btn.Name      = payoff.PayoffID.ToString();
                btn.Text      = payoff.PayoffName;
                btn.Width     = width;
                btn.Height    = height;
                btn.BackColor = btn.DisplayColor = Color.Blue;
                btn.Font      = new Font("Microsoft YaHei", 12F, FontStyle.Regular);
                btn.ForeColor = Color.White;
                btn.Location  = new Point(px, py);
                foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList)
                {
                    if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID))
                    {
                        float     emSize = (float)btnStyle.FontSize;
                        FontStyle style  = FontStyle.Regular;
                        btn.Font      = new Font(btnStyle.FontName, emSize, style);
                        btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor);
                        btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor);
                        break;
                    }
                }
                btn.Tag    = payoff;
                btn.Click += new System.EventHandler(this.btnPayoff_Click);
                pnlPayoffWay.Controls.Add(btn);
                px += width + space;
                if ((index + 1) % 3 == 0)
                {
                    px  = 0;
                    py += height + space;
                }
            }
        }
コード例 #3
0
        private void InitializeRegionDeskButton()
        {
            //禁止引发Layout事件
            this.pnlRegion.SuspendLayout();
            this.pnlDesk.SuspendLayout();
            this.SuspendLayout();
            //动态加载区域控件
            foreach (BizRegion region in ConstantValuePool.RegionList)
            {
                CrystalButton btn = new CrystalButton();
                btn.Name     = region.RegionID.ToString();
                btn.Text     = region.RegionName;
                btn.Width    = region.Width;
                btn.Height   = region.Height;
                btn.Location = new Point(region.PX, region.PY);
                btn.Tag      = region;
                foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList)
                {
                    if (region.ButtonStyleID.Equals(btnStyle.ButtonStyleID))
                    {
                        btn.Font      = new Font(btnStyle.FontName, (float)btnStyle.FontSize, FontStyle.Regular);
                        btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor);
                        btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor);
                        break;
                    }
                }
                btn.Click += new System.EventHandler(this.btnRegion_Click);
                if (_prevRegionButton == null)
                {
                    _prevRegionButton           = btn;
                    _prevRegionButton.BackColor = ConstantValuePool.PressedColor;
                }
                this.pnlRegion.Controls.Add(btn);
            }
            //动态加载第一区域的桌况信息
            BizRegion firstRegion = ConstantValuePool.RegionList[0];

            _currentRegionId = firstRegion.RegionID;
            if (!_dicDeskInRegion.ContainsKey(_currentRegionId))
            {
                List <CrystalButton> btnList = new List <CrystalButton>();
                foreach (BizDesk desk in firstRegion.BizDeskList)
                {
                    CrystalButton btn = new CrystalButton();
                    btn.Name      = desk.DeskID.ToString();
                    btn.Text      = desk.DeskName;
                    btn.Width     = desk.Width;
                    btn.Height    = desk.Height;
                    btn.Location  = new Point(desk.PX, desk.PY);
                    btn.Tag       = desk;
                    btn.Font      = new Font("Arial", ConstantValuePool.BizSettingConfig.FontSize, FontStyle.Regular);
                    btn.ForeColor = Color.White;
                    btn.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo);
                    btn.Click    += new System.EventHandler(this.btnDesk_Click);
                    btnList.Add(btn);
                }
                _dicDeskInRegion.Add(firstRegion.RegionID, btnList);
            }
            foreach (CrystalButton btn in _dicDeskInRegion[firstRegion.RegionID])
            {
                this.pnlDesk.Controls.Add(btn);
            }
            //恢复引发Layout事件
            this.pnlRegion.ResumeLayout(false);
            this.pnlRegion.PerformLayout();
            this.pnlDesk.ResumeLayout(false);
            this.pnlDesk.PerformLayout();
            this.ResumeLayout(false);
        }
コード例 #4
0
        private void InitializeReasonButton()
        {
            int reasonCount = 0;

            foreach (Reason item in ConstantValuePool.ReasonList)
            {
                if (item.ReasonType == (int)ReasonItemType.Reminder)
                {
                    reasonCount++;
                }
            }
            if (reasonCount > 0)
            {
                //判断每行显示多少列
                int maxColumn = Convert.ToInt32(Math.Sqrt(Convert.ToDouble(reasonCount)));
                if (maxColumn * maxColumn < reasonCount)
                {
                    maxColumn++;
                }
                //显示多少行
                int perLine = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(reasonCount) / maxColumn));
                //计算button长宽
                int space  = 6;
                int width  = (this.pnlReason.Width - space * (maxColumn - 1)) / maxColumn;
                int height = (this.pnlReason.Height - space * (perLine - 1)) / perLine;

                int           count = 1;
                int           px = 0, py = 0;
                CrystalButton btn;
                foreach (Reason item in ConstantValuePool.ReasonList)
                {
                    if (item.ReasonType == (int)ReasonItemType.Reminder)
                    {
                        btn          = new CrystalButton();
                        btn.Name     = item.ReasonID.ToString();
                        btn.Tag      = item;
                        btn.Text     = item.ReasonName;
                        btn.Width    = width;
                        btn.Height   = height;
                        btn.Location = new Point(px, py);
                        foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList)
                        {
                            if (item.ButtonStyleID.Equals(btnStyle.ButtonStyleID))
                            {
                                float     emSize = (float)btnStyle.FontSize;
                                FontStyle style  = FontStyle.Regular;
                                btn.Font      = new Font(btnStyle.FontName, emSize, style);
                                btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor);
                                btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor);
                                break;
                            }
                        }
                        btn.Click += new System.EventHandler(this.btnReason_Click);
                        this.pnlReason.Controls.Add(btn);

                        count++;
                        if (count > maxColumn)
                        {
                            px    = 0;
                            py   += height + space;
                            count = 1;
                        }
                        else
                        {
                            px += width + space;
                        }
                    }
                }
            }
        }