Beispiel #1
0
        void pbu_click(object sender)
        {
            ucBusyPhone    pb   = sender as ucBusyPhone;
            TBusinessModel busy = pb.Tag as TBusinessModel;

            selectBusy = busy;
            if (SelectedBusy != null)
            {
                SelectedBusy();
            }
        }
Beispiel #2
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();
        }