示例#1
0
        //按下图标显示
        void pb_MouseDown(object sender, EventArgs e)
        {
            UnitCard pb = sender as UnitCard;

            pb.Image = Properties.Resources.银色_点击后1;
            pb.Brush = new SolidBrush(Color.Black);
            pb.Refresh();
            this.lastCard = pb;
        }
示例#2
0
        //选择部门
        void pb_Click(object sender, EventArgs e)
        {
            UnitCard   pb   = sender as UnitCard;
            TUnitModel unit = pb.Tag as TUnitModel;

            selectUnit = unit;
            if (SelectBusy != null)
            {
                SelectBusy();
            }
        }
示例#3
0
        public int cureentPage = 0;  //页码。从1开始
        //动态创建部门
        public void CreateUnit()
        {
            this.pnUnit.ClearControl();
            int rowCount = 6;   //一行6个
            int count    = 0;
            int sY       = 25;  //起始坐标
            int height   = 105; //一行高度
            int width    = 206;
            int currY    = 0;
            int currX    = 25;
            int yGAP     = 19; //行间距
            int xGAP     = 81; //列间距

            this.pnUnit.MouseUp += this.pb_MouseUp;
            var list = uList.Skip(pageCount * cureentPage).Take(pageCount);

            foreach (var u in list)
            {
                UnitCard pb = new UnitCard();
                pb.Name           = "pb_u_" + count;
                pb.Tag            = u;
                pb.Image          = Properties.Resources.蓝色_点击前1;
                pb.Rectangle.Size = new Size(width, height);
                pb.MouseClick    += pb_Click;
                pb.MouseDown     += pb_MouseDown;
                pb.MouseEnter    += (s, e) =>
                {
                    this.Cursor = Cursors.Hand;
                };
                pb.MouseLeave += (s, e) =>
                {
                    this.Cursor = Cursors.Default;
                };
                pb.Rectangle.Location = new Point(currX, currY + sY);
                currX = currX + width + xGAP;
                if (count % rowCount == rowCount - 1)
                {
                    currY += (sY + height + yGAP);
                    currX  = 25;
                }
                this.pnUnit.AddControl(pb);
                count++;
            }
            this.pnUnit.Draw();
        }
示例#4
0
        UnitCard SetUnit(string name, object tag, Size size, int x, int y)
        {
            UnitCard pb = new UnitCard();

            pb.Name               = name;
            pb.Tag                = tag;
            pb.Image              = Properties.Resources.蓝色_点击前1;
            pb.Rectangle.Size     = size;
            pb.Rectangle.Location = new Point(x, y);
            pb.MouseClick        += pb_Click;
            pb.MouseDown         += pb_MouseDown;
            pb.MouseEnter        += (s, e) =>
            {
                this.Cursor = Cursors.Hand;
            };
            pb.MouseLeave += (s, e) =>
            {
                this.Cursor = Cursors.Default;
            };
            return(pb);
        }
示例#5
0
        //动态创建部门
        public void CreateUnit()
        {
            units = System.Configuration.ConfigurationManager.AppSettings["Units"].ToString().Split('|');
            pos   = System.Configuration.ConfigurationManager.AppSettings["Position"].ToString().Split('#');
            size  = System.Configuration.ConfigurationManager.AppSettings["Size"].ToString().Split('|');
            var uns  = units[cureentPage].Split(',');
            var siz  = size[cureentPage].Split(',');
            var posi = pos[cureentPage].Split('|');

            this.pnUnit.ClearControl();
            pnUnit.BackgroundImage = imgList[cureentPage];
            pnUnit.MouseUp        += this.pb_MouseUp;
            for (int i = 0; i < uns.Count(); i++)
            {
                var      dep   = uList.Where(q => q.unitSeq == uns[i]).FirstOrDefault();
                var      width = Convert.ToInt32(siz[i]);
                var      posx  = Convert.ToInt32(posi[i].Split(',')[0]);
                var      posy  = Convert.ToInt32(posi[i].Split(',')[1]);
                UnitCard pb    = SetUnit("pb_u_" + (i + 1).ToString(), dep, new Size(width, 75), posx, posy);
                this.pnUnit.AddControl(pb);
            }
            this.pnUnit.Draw();
        }