Allow moving pinned images with arrow keys

This commit is contained in:
Jaex 2025-05-20 00:55:21 +03:00
parent 6a28815bd6
commit ec56715b3b
3 changed files with 24 additions and 2 deletions

View File

@ -79,6 +79,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "PinToScreenForm";
this.ShowInTaskbar = false;
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PinToScreenForm_KeyDown);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PinToScreenForm_KeyUp);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PinToScreenForm_MouseDown);
this.MouseEnter += new System.EventHandler(this.PinToScreenForm_MouseEnter);

View File

@ -531,6 +531,27 @@ namespace ShareX
UpdateControls();
}
private void PinToScreenForm_KeyDown(object sender, KeyEventArgs e)
{
int speed = e.Shift ? 10 : 1;
switch (e.KeyCode)
{
case Keys.Left:
Location = new Point(Location.X - speed, Location.Y);
break;
case Keys.Right:
Location = new Point(Location.X + speed, Location.Y);
break;
case Keys.Up:
Location = new Point(Location.X, Location.Y - speed);
break;
case Keys.Down:
Location = new Point(Location.X, Location.Y + speed);
break;
}
}
private void PinToScreenForm_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyData)

View File

@ -171,7 +171,7 @@
<value>3, 2, 1, 1</value>
</data>
<data name="tsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>174, 34</value>
<value>143, 34</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="tsMain.TabIndex" type="System.Int32, mscorlib">
@ -181,7 +181,7 @@
<value>tsMain</value>
</data>
<data name="&gt;&gt;tsMain.Type" xml:space="preserve">
<value>ShareX.HelpersLib.ToolStripEx, ShareX.HelpersLib, Version=16.0.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.ToolStripEx, ShareX.HelpersLib, Version=17.0.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;tsMain.Parent" xml:space="preserve">
<value>$this</value>