Exemplo n.º 1
0
        /// <summary>
        ///获取最大最小尺寸
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        private EdgeSize GetEdgeSize(List <PictureBox> list)
        {
            var size = new EdgeSize();

            foreach (PictureBox pb in list)
            {
                if (list.IndexOf(pb) == 0)
                {
                    size.MinWidth  = pb.Location.X;
                    size.MinHeight = pb.Location.Y;
                }
                size.MinWidth  = Math.Min(size.MinWidth, pb.Location.X);
                size.MinHeight = Math.Min(size.MinHeight, pb.Location.Y);
                size.MaxWidth  = Math.Max(size.MaxWidth, pb.Location.X + pb.Image.Width);
                size.MaxHeight = Math.Max(size.MaxHeight, pb.Location.Y + pb.Image.Height);
            }
            return(size);
        }
Exemplo n.º 2
0
 /// <summary>
 ///获取最大最小尺寸
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 private EdgeSize GetEdgeSize(List<PictureBox> list)
 {
     var size = new EdgeSize();
     foreach (PictureBox pb in list)
     {
         if (list.IndexOf(pb) == 0)
         {
             size.MinWidth = pb.Location.X;
             size.MinHeight = pb.Location.Y;
         }
         size.MinWidth = Math.Min(size.MinWidth, pb.Location.X);
         size.MinHeight = Math.Min(size.MinHeight, pb.Location.Y);
         size.MaxWidth = Math.Max(size.MaxWidth, pb.Location.X + pb.Image.Width);
         size.MaxHeight = Math.Max(size.MaxHeight, pb.Location.Y + pb.Image.Height);
     }
     return size;
 }