mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
ScrollingCaptureLightForm improvements
This commit is contained in:
parent
22c35f38ba
commit
8aecc6bd45
3 changed files with 50 additions and 17 deletions
|
@ -7,19 +7,6 @@ partial class ScrollingCaptureLightForm
|
|||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,6 +57,9 @@ private void InitializeComponent()
|
|||
this.pbOutput.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pbOutput.TabIndex = 0;
|
||||
this.pbOutput.TabStop = false;
|
||||
this.pbOutput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseDown);
|
||||
this.pbOutput.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseMove);
|
||||
this.pbOutput.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseUp);
|
||||
//
|
||||
// tCapture
|
||||
//
|
||||
|
|
|
@ -47,6 +47,7 @@ public partial class ScrollingCaptureLightForm : Form
|
|||
private int currentScrollCount;
|
||||
private WindowInfo selectedWindow;
|
||||
private Rectangle selectedRectangle;
|
||||
private Point dragStartPosition;
|
||||
|
||||
public ScrollingCaptureLightForm(ScrollingCaptureOptions options)
|
||||
{
|
||||
|
@ -58,6 +59,21 @@ public ScrollingCaptureLightForm(ScrollingCaptureOptions options)
|
|||
SelectWindow();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
currentScrollCount = 0;
|
||||
|
@ -111,7 +127,7 @@ private async Task StopCapture()
|
|||
if (isCapturing)
|
||||
{
|
||||
tCapture.Stop();
|
||||
Cursor = Cursors.WaitCursor;
|
||||
pOutput.Cursor = Cursors.WaitCursor;
|
||||
// TODO: Translate
|
||||
btnCapture.Text = "Capture...";
|
||||
btnCapture.Enabled = false;
|
||||
|
@ -120,7 +136,7 @@ private async Task StopCapture()
|
|||
Result = await CombineImagesAsync(images);
|
||||
pbOutput.Image = Result;
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
pOutput.Cursor = Cursors.Default;
|
||||
btnCapture.Enabled = true;
|
||||
btnUpload.Enabled = true;
|
||||
isCapturing = false;
|
||||
|
@ -310,6 +326,33 @@ private void btnOptions_Click(object sender, EventArgs e)
|
|||
|
||||
}
|
||||
|
||||
private void pbOutput_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left && (pOutput.HorizontalScroll.Visible || pOutput.VerticalScroll.Visible))
|
||||
{
|
||||
pOutput.Cursor = Cursors.SizeAll;
|
||||
dragStartPosition = e.Location;
|
||||
}
|
||||
}
|
||||
|
||||
private void pbOutput_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left && (pOutput.HorizontalScroll.Visible || pOutput.VerticalScroll.Visible))
|
||||
{
|
||||
Point scrollOffset = new Point(e.X - dragStartPosition.X, e.Y - dragStartPosition.Y);
|
||||
pOutput.AutoScrollPosition = new Point(-pOutput.AutoScrollPosition.X - scrollOffset.X, -pOutput.AutoScrollPosition.Y - scrollOffset.Y);
|
||||
pOutput.Update();
|
||||
}
|
||||
}
|
||||
|
||||
private void pbOutput_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
pOutput.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
private async void tCapture_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (scrollTop)
|
||||
|
|
|
@ -38,8 +38,8 @@ public class ScrollingCaptureOptions
|
|||
[DefaultValue(500)]
|
||||
public int ScrollDelay { get; set; } = 500;
|
||||
|
||||
[DefaultValue(20)]
|
||||
public int MaximumScrollCount { get; set; } = 100;
|
||||
[DefaultValue(200)]
|
||||
public int MaximumScrollCount { get; set; } = 200;
|
||||
|
||||
[DefaultValue(true)]
|
||||
public bool StartSelectionAutomatically { get; set; } = true;
|
||||
|
|
Loading…
Reference in a new issue