Double SendMouseWheel delta

This commit is contained in:
Jaex 2023-02-25 14:50:36 +03:00
parent 496b8d4167
commit 2cf766a8e2
3 changed files with 748 additions and 451 deletions

View file

@ -25,7 +25,6 @@ private void InitializeComponent()
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScrollingCaptureForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScrollingCaptureForm));
this.btnSelectHandle = new System.Windows.Forms.Button(); this.btnSelectHandle = new System.Windows.Forms.Button();
this.lblControlText = new System.Windows.Forms.Label();
this.btnCapture = new System.Windows.Forms.Button(); this.btnCapture = new System.Windows.Forms.Button();
this.captureTimer = new System.Windows.Forms.Timer(this.components); this.captureTimer = new System.Windows.Forms.Timer(this.components);
this.nudScrollDelay = new System.Windows.Forms.NumericUpDown(); this.nudScrollDelay = new System.Windows.Forms.NumericUpDown();
@ -51,7 +50,6 @@ private void InitializeComponent()
this.cbStartCaptureAutomatically = new System.Windows.Forms.CheckBox(); this.cbStartCaptureAutomatically = new System.Windows.Forms.CheckBox();
this.btnSelectRectangle = new System.Windows.Forms.Button(); this.btnSelectRectangle = new System.Windows.Forms.Button();
this.lblNote = new System.Windows.Forms.Label(); this.lblNote = new System.Windows.Forms.Label();
this.lblSelectedRectangle = new System.Windows.Forms.Label();
this.tpOutput = new System.Windows.Forms.TabPage(); this.tpOutput = new System.Windows.Forms.TabPage();
this.gbImages = new System.Windows.Forms.GroupBox(); this.gbImages = new System.Windows.Forms.GroupBox();
this.btnCombineV2 = new System.Windows.Forms.Button(); this.btnCombineV2 = new System.Windows.Forms.Button();
@ -80,7 +78,6 @@ private void InitializeComponent()
this.pOutput = new System.Windows.Forms.Panel(); this.pOutput = new System.Windows.Forms.Panel();
this.lblProcessing = new System.Windows.Forms.Label(); this.lblProcessing = new System.Windows.Forms.Label();
this.pbOutput = new System.Windows.Forms.PictureBox(); this.pbOutput = new System.Windows.Forms.PictureBox();
this.btnCombineV3 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.nudScrollDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudScrollDelay)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudMaximumScrollCount)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMaximumScrollCount)).BeginInit();
this.tcScrollingCapture.SuspendLayout(); this.tcScrollingCapture.SuspendLayout();
@ -111,11 +108,6 @@ private void InitializeComponent()
this.btnSelectHandle.UseVisualStyleBackColor = true; this.btnSelectHandle.UseVisualStyleBackColor = true;
this.btnSelectHandle.Click += new System.EventHandler(this.btnSelectHandle_Click); this.btnSelectHandle.Click += new System.EventHandler(this.btnSelectHandle_Click);
// //
// lblControlText
//
resources.ApplyResources(this.lblControlText, "lblControlText");
this.lblControlText.Name = "lblControlText";
//
// btnCapture // btnCapture
// //
resources.ApplyResources(this.btnCapture, "btnCapture"); resources.ApplyResources(this.btnCapture, "btnCapture");
@ -184,8 +176,6 @@ private void InitializeComponent()
this.tpCapture.Controls.Add(this.gbWhileCapturing); this.tpCapture.Controls.Add(this.gbWhileCapturing);
this.tpCapture.Controls.Add(this.gbBeforeCapture); this.tpCapture.Controls.Add(this.gbBeforeCapture);
this.tpCapture.Controls.Add(this.lblNote); this.tpCapture.Controls.Add(this.lblNote);
this.tpCapture.Controls.Add(this.lblSelectedRectangle);
this.tpCapture.Controls.Add(this.lblControlText);
this.tpCapture.Controls.Add(this.btnCapture); this.tpCapture.Controls.Add(this.btnCapture);
resources.ApplyResources(this.tpCapture, "tpCapture"); resources.ApplyResources(this.tpCapture, "tpCapture");
this.tpCapture.Name = "tpCapture"; this.tpCapture.Name = "tpCapture";
@ -332,11 +322,6 @@ private void InitializeComponent()
resources.ApplyResources(this.lblNote, "lblNote"); resources.ApplyResources(this.lblNote, "lblNote");
this.lblNote.Name = "lblNote"; this.lblNote.Name = "lblNote";
// //
// lblSelectedRectangle
//
resources.ApplyResources(this.lblSelectedRectangle, "lblSelectedRectangle");
this.lblSelectedRectangle.Name = "lblSelectedRectangle";
//
// tpOutput // tpOutput
// //
this.tpOutput.BackColor = System.Drawing.SystemColors.Window; this.tpOutput.BackColor = System.Drawing.SystemColors.Window;
@ -353,7 +338,6 @@ private void InitializeComponent()
// //
// gbImages // gbImages
// //
this.gbImages.Controls.Add(this.btnCombineV3);
this.gbImages.Controls.Add(this.btnCombineV2); this.gbImages.Controls.Add(this.btnCombineV2);
this.gbImages.Controls.Add(this.txtImagesCount); this.gbImages.Controls.Add(this.txtImagesCount);
this.gbImages.Controls.Add(this.lblImageCount); this.gbImages.Controls.Add(this.lblImageCount);
@ -565,13 +549,6 @@ private void InitializeComponent()
this.pbOutput.Name = "pbOutput"; this.pbOutput.Name = "pbOutput";
this.pbOutput.TabStop = false; this.pbOutput.TabStop = false;
// //
// btnCombineV3
//
resources.ApplyResources(this.btnCombineV3, "btnCombineV3");
this.btnCombineV3.Name = "btnCombineV3";
this.btnCombineV3.UseVisualStyleBackColor = true;
this.btnCombineV3.Click += new System.EventHandler(this.btnCombineV3_Click);
//
// ScrollingCaptureForm // ScrollingCaptureForm
// //
this.AcceptButton = this.btnCapture; this.AcceptButton = this.btnCapture;
@ -584,7 +561,6 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudMaximumScrollCount)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMaximumScrollCount)).EndInit();
this.tcScrollingCapture.ResumeLayout(false); this.tcScrollingCapture.ResumeLayout(false);
this.tpCapture.ResumeLayout(false); this.tpCapture.ResumeLayout(false);
this.tpCapture.PerformLayout();
this.gbAfterCapture.ResumeLayout(false); this.gbAfterCapture.ResumeLayout(false);
this.gbAfterCapture.PerformLayout(); this.gbAfterCapture.PerformLayout();
this.gbWhileCapturing.ResumeLayout(false); this.gbWhileCapturing.ResumeLayout(false);
@ -616,7 +592,6 @@ private void InitializeComponent()
#endregion #endregion
private Button btnSelectHandle; private Button btnSelectHandle;
private Label lblControlText;
private Button btnCapture; private Button btnCapture;
private Timer captureTimer; private Timer captureTimer;
private NumericUpDown nudScrollDelay; private NumericUpDown nudScrollDelay;
@ -656,7 +631,6 @@ private void InitializeComponent()
private Label lblStartDelay; private Label lblStartDelay;
private NumericUpDown nudStartDelay; private NumericUpDown nudStartDelay;
private Button btnSelectRectangle; private Button btnSelectRectangle;
private Label lblSelectedRectangle;
private CheckBox cbAutoCombine; private CheckBox cbAutoCombine;
private CheckBox cbStartSelectionAutomatically; private CheckBox cbStartSelectionAutomatically;
private NumericUpDown nudIgnoreLast; private NumericUpDown nudIgnoreLast;
@ -671,6 +645,5 @@ private void InitializeComponent()
private GroupBox gbWhileCapturing; private GroupBox gbWhileCapturing;
private GroupBox gbBeforeCapture; private GroupBox gbBeforeCapture;
private Button btnCombineV2; private Button btnCombineV2;
private Button btnCombineV3;
} }
} }

View file

@ -128,9 +128,7 @@ private void SelectHandle()
if (simpleWindowInfo != null) if (simpleWindowInfo != null)
{ {
selectedWindow = new WindowInfo(simpleWindowInfo.Handle); selectedWindow = new WindowInfo(simpleWindowInfo.Handle);
lblControlText.Text = selectedWindow.ClassName ?? "";
selectedRectangle = simpleWindowInfo.Rectangle; selectedRectangle = simpleWindowInfo.Rectangle;
lblSelectedRectangle.Text = selectedRectangle.ToString();
btnSelectRectangle.Enabled = btnCapture.Enabled = true; btnSelectRectangle.Enabled = btnCapture.Enabled = true;
if (Options.StartCaptureAutomatically) if (Options.StartCaptureAutomatically)
@ -161,7 +159,6 @@ private void SelectRectangle()
if (RegionCaptureTasks.GetRectangleRegion(out Rectangle rect, RegionCaptureOptions)) if (RegionCaptureTasks.GetRectangleRegion(out Rectangle rect, RegionCaptureOptions))
{ {
selectedRectangle = rect; selectedRectangle = rect;
lblSelectedRectangle.Text = selectedRectangle.ToString();
} }
} }
finally finally
@ -351,7 +348,7 @@ private void captureTimer_Tick(object sender, EventArgs e)
InputHelpers.SendKeyPress(VirtualKeyCode.NEXT); InputHelpers.SendKeyPress(VirtualKeyCode.NEXT);
break; break;
case ScrollingCaptureScrollMethod.MouseWheel: case ScrollingCaptureScrollMethod.MouseWheel:
InputHelpers.SendMouseWheel(-120); InputHelpers.SendMouseWheel(-240);
break; break;
} }
@ -834,17 +831,7 @@ private void btnCombineV2_Click(object sender, EventArgs e)
EndingProcess(); EndingProcess();
} }
private void btnCombineV3_Click(object sender, EventArgs e) private Bitmap CombineImagesV2(List<Bitmap> images)
{
StartingProcess();
DebugTimer timer = new DebugTimer("Combine V3");
Result = CombineImagesV3(images);
pbOutput.Image = Result;
timer.WriteElapsedMilliseconds();
EndingProcess();
}
private Bitmap CombineImagesV3(List<Bitmap> images)
{ {
Bitmap result = (Bitmap)images[0].Clone(); Bitmap result = (Bitmap)images[0].Clone();
@ -933,73 +920,5 @@ private Bitmap CombineImagesV3(List<Bitmap> images)
return result; return result;
} }
private Bitmap CombineImagesV2(List<Bitmap> images)
{
int ignoreRightOffset = 50;
Bitmap result = (Bitmap)images[0].Clone();
for (int i = 1; i < images.Count; i++)
{
Bitmap currentImage = images[i];
bool isMatch = false;
int matchIndex = 0;
using (UnsafeBitmap bmpResult = new UnsafeBitmap(result, true, ImageLockMode.ReadOnly))
using (UnsafeBitmap bmpCurrentImage = new UnsafeBitmap(currentImage, true, ImageLockMode.ReadOnly))
{
Rectangle rect = new Rectangle(0, result.Height - currentImage.Height,
currentImage.Width - (currentImage.Width > ignoreRightOffset ? ignoreRightOffset : 0), currentImage.Height);
for (int y = rect.Y; y < rect.Bottom; y++)
{
isMatch = true;
for (int y2 = 0; y + y2 < rect.Bottom; y2++)
{
for (int x = rect.X; x < rect.Right; x++)
{
if (bmpResult.GetPixel(x, y + y2) != bmpCurrentImage.GetPixel(x, y2))
{
isMatch = false;
break;
}
}
if (!isMatch)
{
break;
}
}
if (isMatch)
{
matchIndex = y;
break;
}
}
}
if (isMatch)
{
Bitmap newResult = new Bitmap(result.Width, matchIndex + currentImage.Height);
using (Graphics g = Graphics.FromImage(newResult))
{
g.DrawImage(result, new Rectangle(0, 0, result.Width, matchIndex),
new Rectangle(0, 0, result.Width, matchIndex), GraphicsUnit.Pixel);
g.DrawImage(currentImage, new Rectangle(0, matchIndex, currentImage.Width, currentImage.Height),
new Rectangle(0, 0, currentImage.Width, currentImage.Height), GraphicsUnit.Pixel);
}
result.Dispose();
result = newResult;
}
}
return result;
}
} }
} }

File diff suppressed because it is too large Load diff