mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Open task menu automatically
This commit is contained in:
parent
244883d2f8
commit
e2b93615fd
4 changed files with 27 additions and 9 deletions
|
@ -37,24 +37,36 @@ public class MenuButton : Button
|
|||
[DefaultValue(false)]
|
||||
public bool ShowMenuUnderCursor { get; set; }
|
||||
|
||||
public void OpenMenu()
|
||||
{
|
||||
if (Menu != null)
|
||||
{
|
||||
OpenMenu(new Point(0, Height));
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenMenu(Point menuPosition)
|
||||
{
|
||||
if (Menu != null)
|
||||
{
|
||||
Menu.Show(this, menuPosition);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs mevent)
|
||||
{
|
||||
base.OnMouseDown(mevent);
|
||||
|
||||
if (Menu != null && mevent.Button == MouseButtons.Left)
|
||||
{
|
||||
Point menuLocation;
|
||||
|
||||
if (ShowMenuUnderCursor)
|
||||
{
|
||||
menuLocation = mevent.Location;
|
||||
OpenMenu(mevent.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
menuLocation = new Point(0, Height - 1);
|
||||
OpenMenu();
|
||||
}
|
||||
|
||||
Menu.Show(this, menuLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -644,6 +644,9 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
{
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.M:
|
||||
CurrentTool = ShapeType.ToolSelect;
|
||||
break;
|
||||
case Keys.R:
|
||||
case Keys.NumPad1:
|
||||
CurrentTool = ShapeType.DrawingRectangle;
|
||||
|
@ -710,9 +713,6 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
case Keys.PageDown:
|
||||
MoveCurrentShapeDown();
|
||||
break;
|
||||
case Keys.M:
|
||||
CurrentTool = ShapeType.ToolSelect;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,6 +219,11 @@ private void StopEditing()
|
|||
UpdateHotkeyStatus();
|
||||
}
|
||||
|
||||
public void OpenTaskMenu()
|
||||
{
|
||||
btnTask.OpenMenu();
|
||||
}
|
||||
|
||||
private void SelectControl()
|
||||
{
|
||||
Selected = true;
|
||||
|
|
|
@ -188,6 +188,7 @@ private void btnAdd_Click(object sender, EventArgs e)
|
|||
UpdateCheckStates();
|
||||
control.Focus();
|
||||
Update();
|
||||
control.OpenTaskMenu();
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in a new issue