mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Added custom region support to scrolling capture
This commit is contained in:
parent
e82e85f762
commit
5ca6514af1
5 changed files with 124 additions and 59 deletions
|
@ -33,6 +33,8 @@ private void InitializeComponent()
|
||||||
this.lblMaximumScrollCount = new System.Windows.Forms.Label();
|
this.lblMaximumScrollCount = new System.Windows.Forms.Label();
|
||||||
this.tcScrollingCapture = new System.Windows.Forms.TabControl();
|
this.tcScrollingCapture = new System.Windows.Forms.TabControl();
|
||||||
this.tpCapture = new System.Windows.Forms.TabPage();
|
this.tpCapture = new System.Windows.Forms.TabPage();
|
||||||
|
this.lblSelectedRectangle = new System.Windows.Forms.Label();
|
||||||
|
this.btnSelectRectangle = new System.Windows.Forms.Button();
|
||||||
this.lblStartDelay = new System.Windows.Forms.Label();
|
this.lblStartDelay = new System.Windows.Forms.Label();
|
||||||
this.nudStartDelay = new System.Windows.Forms.NumericUpDown();
|
this.nudStartDelay = new System.Windows.Forms.NumericUpDown();
|
||||||
this.cbScrollTopBeforeCapture = new System.Windows.Forms.CheckBox();
|
this.cbScrollTopBeforeCapture = new System.Windows.Forms.CheckBox();
|
||||||
|
@ -95,7 +97,7 @@ private void InitializeComponent()
|
||||||
// lblControlText
|
// lblControlText
|
||||||
//
|
//
|
||||||
this.lblControlText.AutoSize = true;
|
this.lblControlText.AutoSize = true;
|
||||||
this.lblControlText.Location = new System.Drawing.Point(324, 21);
|
this.lblControlText.Location = new System.Drawing.Point(328, 21);
|
||||||
this.lblControlText.Name = "lblControlText";
|
this.lblControlText.Name = "lblControlText";
|
||||||
this.lblControlText.Size = new System.Drawing.Size(0, 13);
|
this.lblControlText.Size = new System.Drawing.Size(0, 13);
|
||||||
this.lblControlText.TabIndex = 1;
|
this.lblControlText.TabIndex = 1;
|
||||||
|
@ -103,7 +105,7 @@ private void InitializeComponent()
|
||||||
// btnCapture
|
// btnCapture
|
||||||
//
|
//
|
||||||
this.btnCapture.Enabled = false;
|
this.btnCapture.Enabled = false;
|
||||||
this.btnCapture.Location = new System.Drawing.Point(16, 240);
|
this.btnCapture.Location = new System.Drawing.Point(16, 264);
|
||||||
this.btnCapture.Name = "btnCapture";
|
this.btnCapture.Name = "btnCapture";
|
||||||
this.btnCapture.Size = new System.Drawing.Size(152, 23);
|
this.btnCapture.Size = new System.Drawing.Size(152, 23);
|
||||||
this.btnCapture.TabIndex = 2;
|
this.btnCapture.TabIndex = 2;
|
||||||
|
@ -117,7 +119,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// nudScrollDelay
|
// nudScrollDelay
|
||||||
//
|
//
|
||||||
this.nudScrollDelay.Location = new System.Drawing.Point(136, 92);
|
this.nudScrollDelay.Location = new System.Drawing.Point(136, 116);
|
||||||
this.nudScrollDelay.Maximum = new decimal(new int[] {
|
this.nudScrollDelay.Maximum = new decimal(new int[] {
|
||||||
5000,
|
5000,
|
||||||
0,
|
0,
|
||||||
|
@ -131,7 +133,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// nudMaximumScrollCount
|
// nudMaximumScrollCount
|
||||||
//
|
//
|
||||||
this.nudMaximumScrollCount.Location = new System.Drawing.Point(136, 116);
|
this.nudMaximumScrollCount.Location = new System.Drawing.Point(136, 140);
|
||||||
this.nudMaximumScrollCount.Name = "nudMaximumScrollCount";
|
this.nudMaximumScrollCount.Name = "nudMaximumScrollCount";
|
||||||
this.nudMaximumScrollCount.Size = new System.Drawing.Size(80, 20);
|
this.nudMaximumScrollCount.Size = new System.Drawing.Size(80, 20);
|
||||||
this.nudMaximumScrollCount.TabIndex = 4;
|
this.nudMaximumScrollCount.TabIndex = 4;
|
||||||
|
@ -141,7 +143,7 @@ private void InitializeComponent()
|
||||||
// lblScrollDelay
|
// lblScrollDelay
|
||||||
//
|
//
|
||||||
this.lblScrollDelay.AutoSize = true;
|
this.lblScrollDelay.AutoSize = true;
|
||||||
this.lblScrollDelay.Location = new System.Drawing.Point(16, 96);
|
this.lblScrollDelay.Location = new System.Drawing.Point(16, 120);
|
||||||
this.lblScrollDelay.Name = "lblScrollDelay";
|
this.lblScrollDelay.Name = "lblScrollDelay";
|
||||||
this.lblScrollDelay.Size = new System.Drawing.Size(64, 13);
|
this.lblScrollDelay.Size = new System.Drawing.Size(64, 13);
|
||||||
this.lblScrollDelay.TabIndex = 5;
|
this.lblScrollDelay.TabIndex = 5;
|
||||||
|
@ -150,7 +152,7 @@ private void InitializeComponent()
|
||||||
// lblMaximumScrollCount
|
// lblMaximumScrollCount
|
||||||
//
|
//
|
||||||
this.lblMaximumScrollCount.AutoSize = true;
|
this.lblMaximumScrollCount.AutoSize = true;
|
||||||
this.lblMaximumScrollCount.Location = new System.Drawing.Point(16, 120);
|
this.lblMaximumScrollCount.Location = new System.Drawing.Point(16, 144);
|
||||||
this.lblMaximumScrollCount.Name = "lblMaximumScrollCount";
|
this.lblMaximumScrollCount.Name = "lblMaximumScrollCount";
|
||||||
this.lblMaximumScrollCount.Size = new System.Drawing.Size(111, 13);
|
this.lblMaximumScrollCount.Size = new System.Drawing.Size(111, 13);
|
||||||
this.lblMaximumScrollCount.TabIndex = 6;
|
this.lblMaximumScrollCount.TabIndex = 6;
|
||||||
|
@ -169,6 +171,8 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// tpCapture
|
// tpCapture
|
||||||
//
|
//
|
||||||
|
this.tpCapture.Controls.Add(this.lblSelectedRectangle);
|
||||||
|
this.tpCapture.Controls.Add(this.btnSelectRectangle);
|
||||||
this.tpCapture.Controls.Add(this.lblStartDelay);
|
this.tpCapture.Controls.Add(this.lblStartDelay);
|
||||||
this.tpCapture.Controls.Add(this.nudStartDelay);
|
this.tpCapture.Controls.Add(this.nudStartDelay);
|
||||||
this.tpCapture.Controls.Add(this.cbScrollTopBeforeCapture);
|
this.tpCapture.Controls.Add(this.cbScrollTopBeforeCapture);
|
||||||
|
@ -192,10 +196,29 @@ private void InitializeComponent()
|
||||||
this.tpCapture.Text = "Capture";
|
this.tpCapture.Text = "Capture";
|
||||||
this.tpCapture.UseVisualStyleBackColor = true;
|
this.tpCapture.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// lblSelectedRectangle
|
||||||
|
//
|
||||||
|
this.lblSelectedRectangle.AutoSize = true;
|
||||||
|
this.lblSelectedRectangle.Location = new System.Drawing.Point(328, 45);
|
||||||
|
this.lblSelectedRectangle.Name = "lblSelectedRectangle";
|
||||||
|
this.lblSelectedRectangle.Size = new System.Drawing.Size(0, 13);
|
||||||
|
this.lblSelectedRectangle.TabIndex = 16;
|
||||||
|
//
|
||||||
|
// btnSelectRectangle
|
||||||
|
//
|
||||||
|
this.btnSelectRectangle.Enabled = false;
|
||||||
|
this.btnSelectRectangle.Location = new System.Drawing.Point(16, 40);
|
||||||
|
this.btnSelectRectangle.Name = "btnSelectRectangle";
|
||||||
|
this.btnSelectRectangle.Size = new System.Drawing.Size(304, 23);
|
||||||
|
this.btnSelectRectangle.TabIndex = 15;
|
||||||
|
this.btnSelectRectangle.Text = "(Optional) Select custom region in window...";
|
||||||
|
this.btnSelectRectangle.UseVisualStyleBackColor = true;
|
||||||
|
this.btnSelectRectangle.Click += new System.EventHandler(this.btnSelectRectangle_Click);
|
||||||
|
//
|
||||||
// lblStartDelay
|
// lblStartDelay
|
||||||
//
|
//
|
||||||
this.lblStartDelay.AutoSize = true;
|
this.lblStartDelay.AutoSize = true;
|
||||||
this.lblStartDelay.Location = new System.Drawing.Point(16, 72);
|
this.lblStartDelay.Location = new System.Drawing.Point(16, 96);
|
||||||
this.lblStartDelay.Name = "lblStartDelay";
|
this.lblStartDelay.Name = "lblStartDelay";
|
||||||
this.lblStartDelay.Size = new System.Drawing.Size(60, 13);
|
this.lblStartDelay.Size = new System.Drawing.Size(60, 13);
|
||||||
this.lblStartDelay.TabIndex = 14;
|
this.lblStartDelay.TabIndex = 14;
|
||||||
|
@ -203,7 +226,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// nudStartDelay
|
// nudStartDelay
|
||||||
//
|
//
|
||||||
this.nudStartDelay.Location = new System.Drawing.Point(136, 68);
|
this.nudStartDelay.Location = new System.Drawing.Point(136, 92);
|
||||||
this.nudStartDelay.Maximum = new decimal(new int[] {
|
this.nudStartDelay.Maximum = new decimal(new int[] {
|
||||||
5000,
|
5000,
|
||||||
0,
|
0,
|
||||||
|
@ -218,7 +241,7 @@ private void InitializeComponent()
|
||||||
// cbScrollTopBeforeCapture
|
// cbScrollTopBeforeCapture
|
||||||
//
|
//
|
||||||
this.cbScrollTopBeforeCapture.AutoSize = true;
|
this.cbScrollTopBeforeCapture.AutoSize = true;
|
||||||
this.cbScrollTopBeforeCapture.Location = new System.Drawing.Point(16, 168);
|
this.cbScrollTopBeforeCapture.Location = new System.Drawing.Point(16, 192);
|
||||||
this.cbScrollTopBeforeCapture.Name = "cbScrollTopBeforeCapture";
|
this.cbScrollTopBeforeCapture.Name = "cbScrollTopBeforeCapture";
|
||||||
this.cbScrollTopBeforeCapture.Size = new System.Drawing.Size(223, 17);
|
this.cbScrollTopBeforeCapture.Size = new System.Drawing.Size(223, 17);
|
||||||
this.cbScrollTopBeforeCapture.TabIndex = 12;
|
this.cbScrollTopBeforeCapture.TabIndex = 12;
|
||||||
|
@ -229,7 +252,7 @@ private void InitializeComponent()
|
||||||
// cbStartCaptureAutomatically
|
// cbStartCaptureAutomatically
|
||||||
//
|
//
|
||||||
this.cbStartCaptureAutomatically.AutoSize = true;
|
this.cbStartCaptureAutomatically.AutoSize = true;
|
||||||
this.cbStartCaptureAutomatically.Location = new System.Drawing.Point(16, 144);
|
this.cbStartCaptureAutomatically.Location = new System.Drawing.Point(16, 168);
|
||||||
this.cbStartCaptureAutomatically.Name = "cbStartCaptureAutomatically";
|
this.cbStartCaptureAutomatically.Name = "cbStartCaptureAutomatically";
|
||||||
this.cbStartCaptureAutomatically.Size = new System.Drawing.Size(213, 17);
|
this.cbStartCaptureAutomatically.Size = new System.Drawing.Size(213, 17);
|
||||||
this.cbStartCaptureAutomatically.TabIndex = 11;
|
this.cbStartCaptureAutomatically.TabIndex = 11;
|
||||||
|
@ -240,7 +263,7 @@ private void InitializeComponent()
|
||||||
// cbRemoveDuplicates
|
// cbRemoveDuplicates
|
||||||
//
|
//
|
||||||
this.cbRemoveDuplicates.AutoSize = true;
|
this.cbRemoveDuplicates.AutoSize = true;
|
||||||
this.cbRemoveDuplicates.Location = new System.Drawing.Point(16, 216);
|
this.cbRemoveDuplicates.Location = new System.Drawing.Point(16, 240);
|
||||||
this.cbRemoveDuplicates.Name = "cbRemoveDuplicates";
|
this.cbRemoveDuplicates.Name = "cbRemoveDuplicates";
|
||||||
this.cbRemoveDuplicates.Size = new System.Drawing.Size(117, 17);
|
this.cbRemoveDuplicates.Size = new System.Drawing.Size(117, 17);
|
||||||
this.cbRemoveDuplicates.TabIndex = 10;
|
this.cbRemoveDuplicates.TabIndex = 10;
|
||||||
|
@ -251,7 +274,7 @@ private void InitializeComponent()
|
||||||
// cbAutoDetectScrollEnd
|
// cbAutoDetectScrollEnd
|
||||||
//
|
//
|
||||||
this.cbAutoDetectScrollEnd.AutoSize = true;
|
this.cbAutoDetectScrollEnd.AutoSize = true;
|
||||||
this.cbAutoDetectScrollEnd.Location = new System.Drawing.Point(16, 192);
|
this.cbAutoDetectScrollEnd.Location = new System.Drawing.Point(16, 216);
|
||||||
this.cbAutoDetectScrollEnd.Name = "cbAutoDetectScrollEnd";
|
this.cbAutoDetectScrollEnd.Name = "cbAutoDetectScrollEnd";
|
||||||
this.cbAutoDetectScrollEnd.Size = new System.Drawing.Size(129, 17);
|
this.cbAutoDetectScrollEnd.Size = new System.Drawing.Size(129, 17);
|
||||||
this.cbAutoDetectScrollEnd.TabIndex = 9;
|
this.cbAutoDetectScrollEnd.TabIndex = 9;
|
||||||
|
@ -262,7 +285,7 @@ private void InitializeComponent()
|
||||||
// lblScrollMethod
|
// lblScrollMethod
|
||||||
//
|
//
|
||||||
this.lblScrollMethod.AutoSize = true;
|
this.lblScrollMethod.AutoSize = true;
|
||||||
this.lblScrollMethod.Location = new System.Drawing.Point(16, 48);
|
this.lblScrollMethod.Location = new System.Drawing.Point(16, 72);
|
||||||
this.lblScrollMethod.Name = "lblScrollMethod";
|
this.lblScrollMethod.Name = "lblScrollMethod";
|
||||||
this.lblScrollMethod.Size = new System.Drawing.Size(74, 13);
|
this.lblScrollMethod.Size = new System.Drawing.Size(74, 13);
|
||||||
this.lblScrollMethod.TabIndex = 8;
|
this.lblScrollMethod.TabIndex = 8;
|
||||||
|
@ -272,7 +295,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
this.cbScrollMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.cbScrollMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.cbScrollMethod.FormattingEnabled = true;
|
this.cbScrollMethod.FormattingEnabled = true;
|
||||||
this.cbScrollMethod.Location = new System.Drawing.Point(136, 44);
|
this.cbScrollMethod.Location = new System.Drawing.Point(136, 68);
|
||||||
this.cbScrollMethod.Name = "cbScrollMethod";
|
this.cbScrollMethod.Name = "cbScrollMethod";
|
||||||
this.cbScrollMethod.Size = new System.Drawing.Size(312, 21);
|
this.cbScrollMethod.Size = new System.Drawing.Size(312, 21);
|
||||||
this.cbScrollMethod.TabIndex = 7;
|
this.cbScrollMethod.TabIndex = 7;
|
||||||
|
@ -625,5 +648,7 @@ private void InitializeComponent()
|
||||||
private Label lblImageCount;
|
private Label lblImageCount;
|
||||||
private Label lblStartDelay;
|
private Label lblStartDelay;
|
||||||
private NumericUpDown nudStartDelay;
|
private NumericUpDown nudStartDelay;
|
||||||
|
private Button btnSelectRectangle;
|
||||||
|
private Label lblSelectedRectangle;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,6 +46,7 @@ public partial class ScrollingCaptureForm : BaseForm
|
||||||
public Image Result { get; set; }
|
public Image Result { get; set; }
|
||||||
|
|
||||||
private WindowInfo selectedWindow;
|
private WindowInfo selectedWindow;
|
||||||
|
private Rectangle selectedRectangle;
|
||||||
private List<Image> images = new List<Image>();
|
private List<Image> images = new List<Image>();
|
||||||
private int currentScrollCount;
|
private int currentScrollCount;
|
||||||
private bool isBusy, isCapturing, firstCapture, detectingScrollMethod;
|
private bool isBusy, isCapturing, firstCapture, detectingScrollMethod;
|
||||||
|
@ -104,6 +105,11 @@ private void btnSelectHandle_Click(object sender, EventArgs e)
|
||||||
SelectHandle();
|
SelectHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnSelectRectangle_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectRectangle();
|
||||||
|
}
|
||||||
|
|
||||||
private void SelectHandle()
|
private void SelectHandle()
|
||||||
{
|
{
|
||||||
WindowState = FormWindowState.Minimized;
|
WindowState = FormWindowState.Minimized;
|
||||||
|
@ -113,13 +119,16 @@ private void SelectHandle()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Thread.Sleep(250);
|
Thread.Sleep(250);
|
||||||
|
|
||||||
SimpleWindowInfo simpleWindowInfo = GetWindowInfo();
|
SimpleWindowInfo simpleWindowInfo = GetWindowInfo();
|
||||||
|
|
||||||
if (simpleWindowInfo != null)
|
if (simpleWindowInfo != null)
|
||||||
{
|
{
|
||||||
selectedWindow = new WindowInfo(simpleWindowInfo.Handle);
|
selectedWindow = new WindowInfo(simpleWindowInfo.Handle);
|
||||||
lblControlText.Text = selectedWindow.ClassName ?? string.Empty;
|
lblControlText.Text = selectedWindow.ClassName ?? string.Empty;
|
||||||
btnCapture.Enabled = true;
|
selectedRectangle = simpleWindowInfo.Rectangle;
|
||||||
|
lblSelectedRectangle.Text = selectedRectangle.ToString();
|
||||||
|
btnSelectRectangle.Enabled = btnCapture.Enabled = true;
|
||||||
|
|
||||||
if (Options.StartCaptureAutomatically)
|
if (Options.StartCaptureAutomatically)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +147,27 @@ private void SelectHandle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SelectRectangle()
|
||||||
|
{
|
||||||
|
WindowState = FormWindowState.Minimized;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.Sleep(250);
|
||||||
|
|
||||||
|
Rectangle rect;
|
||||||
|
if (Surface.SelectRegion(out rect))
|
||||||
|
{
|
||||||
|
selectedRectangle = rect;
|
||||||
|
lblSelectedRectangle.Text = selectedRectangle.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.ShowActivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void btnCapture_Click(object sender, EventArgs e)
|
private void btnCapture_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (isCapturing)
|
if (isCapturing)
|
||||||
|
@ -275,7 +305,7 @@ private void captureTimer_Tick(object sender, EventArgs e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Screenshot.CaptureCursor = false;
|
Screenshot.CaptureCursor = false;
|
||||||
Image image = Screenshot.CaptureRectangle(selectedWindow.Rectangle);
|
Image image = Screenshot.CaptureRectangle(selectedRectangle);
|
||||||
|
|
||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -429,5 +429,56 @@ protected override void Dispose(bool disposing)
|
||||||
|
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool SelectRegion(out Rectangle rect)
|
||||||
|
{
|
||||||
|
return SelectRegion(out rect, new SurfaceOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool SelectRegion(out Rectangle rect, SurfaceOptions options)
|
||||||
|
{
|
||||||
|
using (RectangleRegion surface = new RectangleRegion())
|
||||||
|
{
|
||||||
|
surface.Config = options;
|
||||||
|
surface.Config.ShowTips = false;
|
||||||
|
surface.Config.QuickCrop = true;
|
||||||
|
surface.Config.ForceWindowCapture = true;
|
||||||
|
surface.Prepare();
|
||||||
|
surface.ShowDialog();
|
||||||
|
|
||||||
|
if (surface.Result == SurfaceResult.Region)
|
||||||
|
{
|
||||||
|
if (surface.AreaManager.IsCurrentAreaValid)
|
||||||
|
{
|
||||||
|
rect = CaptureHelpers.ClientToScreen(surface.AreaManager.CurrentArea);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (surface.Result == SurfaceResult.Fullscreen)
|
||||||
|
{
|
||||||
|
rect = CaptureHelpers.GetScreenBounds();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (surface.Result == SurfaceResult.Monitor)
|
||||||
|
{
|
||||||
|
Screen[] screens = Screen.AllScreens;
|
||||||
|
|
||||||
|
if (surface.MonitorIndex < screens.Length)
|
||||||
|
{
|
||||||
|
Screen screen = screens[surface.MonitorIndex];
|
||||||
|
rect = screen.Bounds;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (surface.Result == SurfaceResult.ActiveMonitor)
|
||||||
|
{
|
||||||
|
rect = CaptureHelpers.GetActiveScreenBounds();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rect = Rectangle.Empty;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ namespace ShareX
|
||||||
public class ScrollingCaptureOptions
|
public class ScrollingCaptureOptions
|
||||||
{
|
{
|
||||||
public ScrollingCaptureScrollMethod ScrollMethod { get; set; } = ScrollingCaptureScrollMethod.Automatic;
|
public ScrollingCaptureScrollMethod ScrollMethod { get; set; } = ScrollingCaptureScrollMethod.Automatic;
|
||||||
public int StartDelay { get; set; } = 1000;
|
public int StartDelay { get; set; } = 500;
|
||||||
public int ScrollDelay { get; set; } = 500;
|
public int ScrollDelay { get; set; } = 500;
|
||||||
public int MaximumScrollCount { get; set; } = 20;
|
public int MaximumScrollCount { get; set; } = 20;
|
||||||
public bool StartSelectionAutomatically { get; set; } = true;
|
public bool StartSelectionAutomatically { get; set; } = true;
|
||||||
|
|
|
@ -324,48 +324,7 @@ private static void AddExternalProgramFromRegistry(TaskSettings taskSettings, st
|
||||||
|
|
||||||
public static bool SelectRegion(out Rectangle rect, TaskSettings taskSettings)
|
public static bool SelectRegion(out Rectangle rect, TaskSettings taskSettings)
|
||||||
{
|
{
|
||||||
using (RectangleRegion surface = new RectangleRegion())
|
return Surface.SelectRegion(out rect, taskSettings.CaptureSettings.SurfaceOptions);
|
||||||
{
|
|
||||||
surface.Config = taskSettings.CaptureSettings.SurfaceOptions;
|
|
||||||
surface.Config.ShowTips = false;
|
|
||||||
surface.Config.QuickCrop = true;
|
|
||||||
surface.Config.ForceWindowCapture = true;
|
|
||||||
surface.Prepare();
|
|
||||||
surface.ShowDialog();
|
|
||||||
|
|
||||||
if (surface.Result == SurfaceResult.Region)
|
|
||||||
{
|
|
||||||
if (surface.AreaManager.IsCurrentAreaValid)
|
|
||||||
{
|
|
||||||
rect = CaptureHelpers.ClientToScreen(surface.AreaManager.CurrentArea);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (surface.Result == SurfaceResult.Fullscreen)
|
|
||||||
{
|
|
||||||
rect = CaptureHelpers.GetScreenBounds();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (surface.Result == SurfaceResult.Monitor)
|
|
||||||
{
|
|
||||||
Screen[] screens = Screen.AllScreens;
|
|
||||||
|
|
||||||
if (surface.MonitorIndex < screens.Length)
|
|
||||||
{
|
|
||||||
Screen screen = screens[surface.MonitorIndex];
|
|
||||||
rect = screen.Bounds;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (surface.Result == SurfaceResult.ActiveMonitor)
|
|
||||||
{
|
|
||||||
rect = CaptureHelpers.GetActiveScreenBounds();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rect = Rectangle.Empty;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PointInfo SelectPointColor()
|
public static PointInfo SelectPointColor()
|
||||||
|
|
Loading…
Reference in a new issue