예제 #1
0
파일: FormMain.cs 프로젝트: leadline/Tools
        /// <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);
        }
예제 #2
0
파일: FormMain.cs 프로젝트: XINLIUL/sprite
 /// <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;
 }