mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Make splash screen draggable
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -14,6 +15,14 @@ namespace Squirrel.Update
|
||||
{
|
||||
public class AnimatedGifWindow : Form
|
||||
{
|
||||
const int WM_NCLBUTTONDOWN = 0xA1;
|
||||
const int HT_CAPTION = 0x2;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ReleaseCapture();
|
||||
|
||||
PictureBox pictureBox;
|
||||
|
||||
AnimatedGifWindow()
|
||||
@@ -47,6 +56,14 @@ namespace Squirrel.Update
|
||||
this.CenterToScreen();
|
||||
};
|
||||
|
||||
// Enable left-mouse button to drag window
|
||||
pictureBox.MouseDown += (o, e) => {
|
||||
if (e.Button == MouseButtons.Left) {
|
||||
ReleaseCapture();
|
||||
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
|
||||
}
|
||||
};
|
||||
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.Width = 1;
|
||||
this.Height = 1;
|
||||
|
||||
Reference in New Issue
Block a user