Пример #1
0
        /// <summary>
        /// 给控件绑定数据的时候初始化床头卡控件
        /// </summary>
        /// <param name="bedlist"></param>
        public void InitBedInfoControl(Object bedlist)
        {
            if (bedlist is IList)
            {
                flpBed.SuspendLayout();
                flpBed.Controls.Clear();
                flpBed.AutoScroll = true;
                for (int i = 0; i < (bedlist as IList).Count; i++)
                {
                    BedItem bed = new BedItem();
                    bed.SuspendLayout();
                    bed.Name = "BedCard";
                    bed.Size = new System.Drawing.Size(_BedWidth, _BedHeight);
                    bed.ResumeLayout(false);
                    bed.Bed      = (BedInfo)((bedlist as IList)[i]);
                    bed.BedIndex = i;

                    bed.Click       += new EventHandler(bed_Click);
                    bed.DoubleClick += new EventHandler(bed_DoubleClick);
                    bed.Paint       += new PaintEventHandler(bed_Paint);
                    bed.MouseMove   += new MouseEventHandler(bed_MouseMove);
                    bed.MouseDown   += new MouseEventHandler(bed_MouseDown);
                    bed.MouseUp     += new MouseEventHandler(bed_MouseUp);
                    bed.MouseEnter  += new EventHandler(bed_MouseEnter);
                    bed.MouseLeave  += new EventHandler(bed_MouseLeave);
                    bed.Resize      += new EventHandler(bed_Resize);
                    bed.Margin       = new System.Windows.Forms.Padding(10, 10, 3, 3);

                    bed_Resize(null, null);
                    _rectBed = new Rectangle(1, 1, _bedWidth, _titleHeight - 2);
                    flpBed.Controls.Add(bed);
                }
                flpBed.ResumeLayout(true);
            }
        }
Пример #2
0
        public void InitBedInfoControl(Object bedlist)
        {
            if (bedlist is IList)
            {
                flpBed.SuspendLayout();
                flpBed.Controls.Clear();
                flpBed.AutoScroll = true;
                for (int i = 0; i < (bedlist as IList).Count; i++)
                {
                    BedItem bed = new BedItem();
                    bed.SuspendLayout();
                    bed.Name = "BedCard";
                    bed.Size = new System.Drawing.Size(_BedWidth, _BedHeight);
                    bed.ResumeLayout(false);
                    bed.Bed      = (BedInfo)((bedlist as IList)[i]);
                    bed.BedIndex = i;

                    bed.Click       += new EventHandler(bed_Click);
                    bed.DoubleClick += new EventHandler(bed_DoubleClick);
                    bed.Paint       += new PaintEventHandler(bed_Paint);
                    bed.MouseMove   += new MouseEventHandler(bed_MouseMove);
                    bed.MouseDown   += new MouseEventHandler(bed_MouseDown);
                    bed.MouseUp     += new MouseEventHandler(bed_MouseUp);
                    bed.MouseLeave  += new EventHandler(bed_MouseLeave);
                    bed.Resize      += new EventHandler(bed_Resize);


                    _rectTitle   = new Rectangle(0, 0, BedWidth - 1, 25);
                    _rectContext = new Rectangle(0, _rectTitle.Height, _BedWidth - 1, _BedHeight - _rectTitle.Height - 1);
                    _rectBed     = new Rectangle(1, 1, 40, _rectTitle.Height - 2);

                    flpBed.Controls.Add(bed);
                }
                flpBed.ResumeLayout(true);
            }
        }