Example #1
0
 /// <summary>
 /// 楼层按钮的构造
 /// </summary>
 public void AddFloor()
 {
     for (int i = 0; i < PassValue.tablesstatuslist.Count(); i++)
     {
         FloorControl.FloorControl fc = new FloorControl.FloorControl(); //实例化新建楼层
         fc.Tag          = PassValue.tablesstatuslist[i];                //给楼层控件的tag赋个值
         fc.Cursor       = Cursors.Hand;                                 //悬停效果为手型按钮
         fc.lbFloor.Tag  = PassValue.tablesstatuslist[i];                //给楼层控件里的label的tag也赋个值
         fc.lbFloor.Text = PassValue.tablesstatuslist[i].ToString();     //楼层控件Label赋值(楼层显示的名字)
         this.PanelFloor.Controls.Add(fc);                               //添加到容器里面
         if (i == 0)                                                     //初始化,指针给第一个楼层按钮
         {
             fc.picFloor.Image     = Properties.Resources.楼层选中;          //改变楼层按钮背景色
             fc.lbFloor.ForeColor  = Color.White;                        //改变字体颜色
             PassValue.ChooseFloor = fc.Tag.ToString();                  //将楼层的tag作为标识传到公共变量里存储
             this.picTriangle.Top  = 40;                                 //楼层向导小三角的初始位置控制
         }
         fc.Left       = (this.PanelFloor.Width - fc.Width) / 2;         //楼层按钮在容器中居中
         fc.Top        = 30 + 60 * i;                                    //控制楼层按钮的上下间距
         fc.MouseDown += new MouseEventHandler(btnfloor_MouseDown);      //定义楼层点击事件
     }
 }
Example #2
0
        /// <summary>
        /// 楼层的切换
        /// </summary>
        public void btnfloor_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                PassValue.ht.Clear();                    //清空哈希表
                if (sender is FloorControl.FloorControl) //判断是否点击到楼层按钮
                {
                    FloorControl.FloorControl fc = (FloorControl.FloorControl)sender;
                    PassValue.ChooseFloor = fc.Tag.ToString();
                    foreach (Control ctl in this.PanelFloor.Controls)
                    {
                        if (ctl is FloorControl.FloorControl == false)
                        {
                            continue;
                        }

                        FloorControl.FloorControl fcc = ctl as FloorControl.FloorControl;
                        if (ctl.Tag.ToString() == PassValue.ChooseFloor)
                        {
                            fcc.picFloor.Image    = Properties.Resources.楼层选中;//选中按钮变成橘黄色
                            fcc.lbFloor.ForeColor = Color.White;
                        }
                        else
                        {
                            fcc.picFloor.Image    = Properties.Resources.楼层未选中;//未选中按钮的颜色变成灰色
                            fcc.lbFloor.ForeColor = Color.Black;
                        }
                    }
                }
                changefloor();                   //小三角的位置的变化
                this.panelDesk.Controls.Clear(); //清空tab里面的内容准备重新加载
                AddTables();                     //添加桌子

                //选中之前选择的桌子
                ChooseCurrent();
            }
        }
Example #3
0
 /// <summary>
 /// 楼层按钮的构造
 /// </summary>
 public void AddFloor()
 {
     for (int i = 0; i < PassValue.tablesstatuslist.Count(); i++)
     {
         FloorControl.FloorControl fc = new FloorControl.FloorControl();//实例化新建楼层
         fc.Tag = PassValue.tablesstatuslist[i];//给楼层控件的tag赋个值
         fc.Cursor = Cursors.Hand;//悬停效果为手型按钮
         fc.lbFloor.Tag = PassValue.tablesstatuslist[i];//给楼层控件里的label的tag也赋个值
         fc.lbFloor.Text = PassValue.tablesstatuslist[i].ToString();//楼层控件Label赋值(楼层显示的名字)
         this.PanelFloor.Controls.Add(fc);//添加到容器里面
         if (i == 0)//初始化,指针给第一个楼层按钮
         {
             fc.picFloor.Image = Properties.Resources.楼层选中;//改变楼层按钮背景色
             fc.lbFloor.ForeColor = Color.White;//改变字体颜色
             PassValue.ChooseFloor = fc.Tag.ToString();//将楼层的tag作为标识传到公共变量里存储
             this.picTriangle.Top = 40;//楼层向导小三角的初始位置控制
         }
         fc.Left = (this.PanelFloor.Width - fc.Width) / 2;//楼层按钮在容器中居中
         fc.Top = 30 + 60 * i;//控制楼层按钮的上下间距
         fc.MouseDown += new MouseEventHandler(btnfloor_MouseDown);//定义楼层点击事件
     }
 }