mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 20:54:20 +01:00
convert app to windows forms
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user