diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj
index 0d6d820..c53c735 100644
--- a/STranslate/STranslate.csproj
+++ b/STranslate/STranslate.csproj
@@ -78,6 +78,9 @@
+
+ ..\packages\WpfScreenHelper.2.1.0\lib\net40\WpfScreenHelper.dll
+
diff --git a/STranslate/Util/Util.cs b/STranslate/Util/Util.cs
index 0b8b8d6..77f5b31 100644
--- a/STranslate/Util/Util.cs
+++ b/STranslate/Util/Util.cs
@@ -2,6 +2,7 @@
using STranslate.Model;
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
@@ -9,6 +10,8 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
+using System.Windows;
+using System.Windows.Media;
namespace STranslate.Util
{
@@ -236,5 +239,33 @@ namespace STranslate.Util
return strA_Z;
}
#endregion
+
+ #region Screenshot
+ public static ImageBrush BitmapToImageBrush(Bitmap bmp)
+ {
+ ImageBrush brush = new ImageBrush();
+ IntPtr hBitmap = bmp.GetHbitmap();
+ ImageSource wpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
+ hBitmap,
+ IntPtr.Zero,
+ Int32Rect.Empty,
+ System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
+ brush.ImageSource = wpfBitmap;
+ //TODO: flush Memory
+ return brush;
+ }
+ ///
+ /// 清理内存
+ ///
+ public static void FlushMemory()
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
+ {
+ Helper.NativeMethodHelper.SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
+ }
+ }
+ #endregion
}
}
diff --git a/STranslate/View/ScreenShotWindow.xaml b/STranslate/View/ScreenShotWindow.xaml
index f2243d9..9f1664e 100644
--- a/STranslate/View/ScreenShotWindow.xaml
+++ b/STranslate/View/ScreenShotWindow.xaml
@@ -34,6 +34,9 @@
+
+
+