diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-15 14:48:35 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-15 14:48:35 -0500 |
| commit | 46f668fbd801adc506832166a8c792458890813b (patch) | |
| tree | 62b91174747c35a40eecdcaff5640788a4796f09 /MediaBrowser.ServerApplication/Splash/SplashForm.cs | |
| parent | bf1c36ba613c5b62a43fb2f56590e1337945ed6a (diff) | |
convert app to windows forms
Diffstat (limited to 'MediaBrowser.ServerApplication/Splash/SplashForm.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Splash/SplashForm.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/MediaBrowser.ServerApplication/Splash/SplashForm.cs b/MediaBrowser.ServerApplication/Splash/SplashForm.cs index 1260c3405..845ad74fb 100644 --- a/MediaBrowser.ServerApplication/Splash/SplashForm.cs +++ b/MediaBrowser.ServerApplication/Splash/SplashForm.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -42,4 +43,29 @@ namespace MediaBrowser.ServerApplication.Splash base.OnClosing(e); } } + + public static class ControlHelper + { + #region Redraw Suspend/Resume + [DllImport("user32.dll", EntryPoint = "SendMessageA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)] + private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); + private const int WM_SETREDRAW = 0xB; + + public static void SuspendDrawing(this Control target) + { + SendMessage(target.Handle, WM_SETREDRAW, 0, 0); + } + + public static void ResumeDrawing(this Control target) { ResumeDrawing(target, true); } + public static void ResumeDrawing(this Control target, bool redraw) + { + SendMessage(target.Handle, WM_SETREDRAW, 1, 0); + + if (redraw) + { + target.Refresh(); + } + } + #endregion + } } |
