using System.Drawing; namespace Microsoft.Drawing { /// /// Size 操作 /// public static class SizeEx { /// /// 调整大小非空,影响原来大小 /// /// 要调整的大小 public static void MakeNotEmpty(ref Size size) { if (size.Width < 1) size.Width = 1; if (size.Height < 1) size.Height = 1; } /// /// 宽度放大倍数 /// /// Size /// 倍数 /// 新的Size public static Size MultiplyWidth(Size size, int count) { return new Size(size.Width * count, size.Height); } /// /// 高度放大倍数 /// /// Size /// 倍数 /// 新的Size public static Size MultiplyHeight(Size size, int count) { return new Size(size.Width, size.Height * count); } /// /// 宽度和高度放大倍数 /// /// Size /// 倍数 /// 新的Size public static Size MultiplyBoth(Size size, int count) { return new Size(size.Width * count, size.Height * count); } } }