Ejemplo n.º 1
0
        public void CreateBusiness()
        {
            this.pnBusiness.ClearControl();
            int count = 0;
            int sY    = 0;//起始坐标
            int sX    = 0;
            var list  = bList.Skip(pageCount * cureentPage).Take(pageCount);

            foreach (var u in list)
            {
                ucBusyPhone pb = new ucBusyPhone();
                pb.Name                     = "pb_b_" + count;
                pb.Tag                      = u;
                pb.unitSeq                  = u.unitSeq;
                pb.busiSeq                  = u.busiSeq;
                pb.busiName                 = u.busiName;
                pb.action                  += new Action <object>(pbu_click);
                pb.Rectangle.Location       = new Point(sX, sY);
                pb.Rectangle.Size           = new Size(429, 737);
                pb.ButtonRectangle.Location = new Point(sX + 60, sY + 5);
                pb.ButtonRectangle.Size     = new Size(280, 50);
                pnBusiness.AddControl(pb);
                count++;
                sX += pb.Rectangle.Width;
            }
            pnBusiness.MouseMove += (s, e) =>
            {
                var ctl = pnBusiness.controls.Find(m => ((ucBusyPhone)m).ButtonRectangle.Contains(e.Location)) as ucBusyPhone;
                if (ctl != null)
                {
                    this.Cursor = Cursors.Hand;
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            };
            pnBusiness.MouseClick += (s, e) =>
            {
                var ctl = pnBusiness.controls.Find(m => ((ucBusyPhone)m).ButtonRectangle.Contains(e.Location)) as ucBusyPhone;
                if (ctl != null)
                {
                    ctl.OnButtonClick();
                }
            };
            pnBusiness.Draw();
        }
Ejemplo n.º 2
0
        public void CreateBusiness()
        {
            this.pnBusiness.ClearControl();
            int rowCount = 6;//一行
            int count    = 0;
            //int sX = 25;//起始坐标
            int sY     = 25;  //起始坐标
            int height = 105; //一行高度
            int width  = 206;
            int currY  = 0;
            int currX  = 6;
            int yGAP   = 19; //行间距
            int xGAP   = 81; //列间距
            var list   = bList.Skip(pageCount * cureentPage).Take(pageCount);

            this.pnBusiness.MouseUp += this.pb_MouseUp;
            foreach (var u in list)
            {
                ucBusy pb = new ucBusy();
                pb.Name        = "pb_b_" + count;
                pb.Tag         = u;
                pb.MouseEnter += (s, e) =>
                {
                    this.Cursor = Cursors.Hand;
                };
                pb.MouseLeave += (s, e) =>
                {
                    this.Cursor = Cursors.Default;
                };
                pb.Image              = Properties.Resources.蓝色_点击前1;
                pb.Rectangle.Size     = new Size(width, height);
                pb.MouseClick        += pbu_Click;
                pb.MouseDown         += pb_MouseDown;
                pb.Rectangle.Location = new Point(currX, currY + sY);
                currX = currX + width + xGAP;
                if (count % rowCount == rowCount - 1)
                {
                    currY += (sY + height + yGAP);
                    currX  = 6;
                }
                pnBusiness.AddControl(pb);
                count++;
            }
            pnBusiness.Draw();
        }