#if NET40 || NET461 using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Apewer.Surface { /// public static class Extensions { /// 保存为 PNG 文件。 public static byte[] SaveAsPng(this Image @this, bool disposeImage = false) { return ImageUtility.SaveAsBytes(@this, ImageFormat.Png, disposeImage); } /// 保存为 JPEG 文件。 public static byte[] SaveAsJpeg(this Image @this, bool disposeImage = false) { return ImageUtility.SaveAsBytes(@this, ImageFormat.Jpeg, disposeImage); } /// public static void BeginInvoke(this Control control, Action action) { if (action == null) return; control.BeginInvoke(action as Delegate); } /// public static void Invoke(this Control control, Action action) { if (action == null) return; control.Invoke(action as Delegate); } } } #endif