Allow dragging recording window when paused

This commit is contained in:
Jaex 2022-09-04 00:56:10 +03:00
parent eb3bb1dbea
commit f379d5bab1
3 changed files with 27 additions and 7 deletions

View file

@ -22,11 +22,11 @@ private void InitializeComponent()
this.timerRefresh = new System.Windows.Forms.Timer(this.components);
this.btnAbort = new ShareX.HelpersLib.NoFocusBorderButton();
this.pInfo = new System.Windows.Forms.Panel();
this.btnPause = new ShareX.HelpersLib.NoFocusBorderButton();
this.cmsMain = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiStart = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiAbort = new System.Windows.Forms.ToolStripMenuItem();
this.niTray = new System.Windows.Forms.NotifyIcon(this.components);
this.btnPause = new ShareX.HelpersLib.NoFocusBorderButton();
this.pInfo.SuspendLayout();
this.cmsMain.SuspendLayout();
this.SuspendLayout();
@ -41,6 +41,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.lblTimer, "lblTimer");
this.lblTimer.Name = "lblTimer";
this.lblTimer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTimer_MouseDown);
//
// timerRefresh
//
@ -61,6 +62,12 @@ private void InitializeComponent()
this.pInfo.Controls.Add(this.lblTimer);
this.pInfo.Name = "pInfo";
//
// btnPause
//
resources.ApplyResources(this.btnPause, "btnPause");
this.btnPause.Name = "btnPause";
this.btnPause.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnPause_MouseClick);
//
// cmsMain
//
this.cmsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -89,12 +96,6 @@ private void InitializeComponent()
resources.ApplyResources(this.niTray, "niTray");
this.niTray.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnStart_MouseClick);
//
// btnPause
//
resources.ApplyResources(this.btnPause, "btnPause");
this.btnPause.Name = "btnPause";
this.btnPause.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnPause_MouseClick);
//
// ScreenRecordForm
//
resources.ApplyResources(this, "$this");

View file

@ -60,6 +60,14 @@ private set
public float Duration { get; set; } = 0;
public bool AskConfirmationOnAbort { get; set; } = false;
public Rectangle RecordRectangle
{
get
{
return new Rectangle(Location.X + 1, Location.Y + 1, borderRectangle.Width - 2, borderRectangle.Height - 2);
}
}
private Color borderColor = Color.Red;
private Rectangle borderRectangle;
private Rectangle borderRectangle0Based;
@ -262,6 +270,15 @@ private void btnAbort_MouseClick(object sender, MouseEventArgs e)
}
}
private void lblTimer_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && Status == ScreenRecordingStatus.Paused)
{
NativeMethods.ReleaseCapture();
NativeMethods.SendMessage(Handle, (uint)WindowsMessages.NCLBUTTONDOWN, (IntPtr)WindowHitTestRegions.HTCAPTION, IntPtr.Zero);
}
}
public void StartStopRecording(bool pause = false)
{
if (Status == ScreenRecordingStatus.Aborted)

View file

@ -255,6 +255,8 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
FileHelpers.RenameFile(path, concatPath);
}
captureRectangle = recordForm.RecordRectangle;
ScreenRecordingOptions options = new ScreenRecordingOptions()
{
IsRecording = true,