Example #1
0
        private PictureBox CreateBellPic(UserPhotoItem item)
        {
            PictureBox p = new PictureBox();

            p.Image            = ResourceLib.outbell;
            p.Size             = new System.Drawing.Size(33, 42);
            p.Location         = new Point(item.Location.X - 20, item.Location.Y - 9);
            p.Visible          = false;
            item.LinkedControl = p;
            return(p);
        }
Example #2
0
        /// <summary>
        /// 初始化指定数量的照片控件
        /// </summary>
        /// <param name="count"></param>
        public void InitPictureBox(int count)
        {
            int c = 0;

            pics = new  List <UserPhotoItem> ();
            int rowMax = rows == 0?99999:rows;
            //调整位置
            int adjustX = 0, adjustY = 0;

            if (itemAlign == ContentAlignment.MiddleCenter || itemAlign == ContentAlignment.MiddleLeft || itemAlign == ContentAlignment.MiddleRight)
            {
                int rowCount = (int)Math.Ceiling(count * 1.0 / columns);
                var needY    = rowCount * (pictureSize.Height + 2 * pictureBorderWidth) + (rowCount - 1) * cellHeight;
                adjustY = (this.Height - needY) / 2;
            }
            if (itemAlign == ContentAlignment.BottomCenter || itemAlign == ContentAlignment.MiddleCenter || itemAlign == ContentAlignment.TopCenter)
            {
                var needX = columns * (pictureSize.Width + 2 * pictureBorderWidth) + (columns - 1) * cellWidth;
                adjustX = (this.Width - needX) / 2;
            }
            if (itemAlign == ContentAlignment.BottomRight || itemAlign == ContentAlignment.MiddleRight || itemAlign == ContentAlignment.TopRight)
            {
                var needX = columns * (pictureSize.Width + 2 * pictureBorderWidth) + (columns - 1) * cellWidth;
                adjustX = this.Width - needX;
            }
            //初始化照片控件
            for (int row = 0; row < rowMax; row++)
            {
                for (int column = 0; column < Columns; column++)
                {
                    if (count == c)
                    {
                        return;
                    }
                    UserPhotoItem p = new UserPhotoItem();
                    p.ShowLabel       = showLabel;
                    p.Size            = pictureSize;
                    p.ShowContextMenu = showContextMenu;
                    int width  = pictureSize.Width + cellWidth;
                    int height = pictureSize.Height + cellHeight;
                    p.Location      = new Point(column * width + pictureBorderWidth + adjustX, row * height + pictureBorderWidth + adjustY);
                    p.UserCheckin  += new EventHandler(p_UserCheckin);
                    p.UserCheckout += new EventHandler(p_UserCheckout);
                    //p.LocationChanged += new EventHandler(p_LocationChanged);
                    this.Controls.Add(p);
                    this.Controls.Add(CreateBellPic(p));
                    pics.Add(p);
                    c++;
                }
            }
        }
Example #3
0
 private PictureBox CreateBellPic(UserPhotoItem item)
 {
     PictureBox p = new PictureBox();
     p.Image = ResourceLib.outbell;
     p.Size = new System.Drawing.Size(33, 42);
     p.Location = new Point(item.Location.X-20,item.Location.Y-9);
     p.Visible = false;
     item.LinkedControl = p;
     return p;
 }
Example #4
0
 private void ShowCheckinFlag(UserPhotoItem item)
 {
     item.LinkedControl.Location = new Point(item.Location.X - 20, item.Location.Y - 9);
     item.LinkedControl.Visible = item.ShowBorder;
     item.ShowRealPhoto(!item.ShowBorder);
 }
Example #5
0
 /// <summary>
 /// 初始化指定数量的照片控件
 /// </summary>
 /// <param name="count"></param>
 public void InitPictureBox(int count)
 {
     int c = 0;
    pics = new  List<UserPhotoItem> ();
    int rowMax = rows==0?99999:rows;
     //调整位置
    int adjustX = 0, adjustY = 0;
    if (itemAlign == ContentAlignment.MiddleCenter || itemAlign == ContentAlignment.MiddleLeft || itemAlign == ContentAlignment.MiddleRight)
    {
        int rowCount = (int)Math.Ceiling(count*1.0 / columns);
        var needY = rowCount * (pictureSize.Height + 2 * pictureBorderWidth) + (rowCount - 1) * cellHeight;
        adjustY = (this.Height - needY) / 2;
    }
    if (itemAlign == ContentAlignment.BottomCenter || itemAlign == ContentAlignment.MiddleCenter || itemAlign == ContentAlignment.TopCenter)
    {
        var needX = columns * (pictureSize.Width + 2 * pictureBorderWidth) + (columns - 1) * cellWidth;
        adjustX = (this.Width - needX) / 2;
    }
    if (itemAlign == ContentAlignment.BottomRight || itemAlign == ContentAlignment.MiddleRight || itemAlign == ContentAlignment.TopRight)
    {
        var needX = columns * (pictureSize.Width + 2 * pictureBorderWidth) + (columns - 1) * cellWidth;
        adjustX = this.Width - needX;
    }
     //初始化照片控件
    for (int row = 0; row < rowMax; row++)
     {
         for (int column = 0; column < Columns; column++)
         {
             if (count == c)
             {
                 return ;
             }
             UserPhotoItem p = new UserPhotoItem();
             p.ShowLabel = showLabel;
             p.Size = pictureSize;
             p.ShowContextMenu = showContextMenu;
             int width = pictureSize.Width + cellWidth;
             int height = pictureSize.Height + cellHeight;
             p.Location = new Point(column * width + pictureBorderWidth + adjustX, row * height + pictureBorderWidth + adjustY);
             p.UserCheckin += new EventHandler(p_UserCheckin);
             p.UserCheckout += new EventHandler(p_UserCheckout);
             //p.LocationChanged += new EventHandler(p_LocationChanged);
             this.Controls.Add(p);
             this.Controls.Add(CreateBellPic(p));
             pics.Add(p);
             c++;
         }
     }
 }
Example #6
0
 private void ShowCheckinFlag(UserPhotoItem item)
 {
     item.LinkedControl.Location = new Point(item.Location.X - 20, item.Location.Y - 9);
     item.LinkedControl.Visible  = item.ShowBorder;
     item.ShowRealPhoto(!item.ShowBorder);
 }