mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-30 12:11:07 +12:00
MenuButton changes
This commit is contained in:
parent
1486c80318
commit
35116b47c8
|
@ -104,7 +104,6 @@ private void InitializeComponent()
|
|||
//
|
||||
resources.ApplyResources(this.btnImport, "btnImport");
|
||||
this.btnImport.Menu = this.cmsImport;
|
||||
this.btnImport.MenuX0 = true;
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
@ -112,7 +111,6 @@ private void InitializeComponent()
|
|||
//
|
||||
resources.ApplyResources(this.btnExport, "btnExport");
|
||||
this.btnExport.Menu = this.cmsExport;
|
||||
this.btnExport.MenuX0 = true;
|
||||
this.btnExport.Name = "btnExport";
|
||||
this.btnExport.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MenuButton : Button
|
|||
public ContextMenuStrip Menu { get; set; }
|
||||
|
||||
[DefaultValue(false)]
|
||||
public bool MenuX0 { get; set; }
|
||||
public bool ShowMenuUnderCursor { get; set; }
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs mevent)
|
||||
{
|
||||
|
@ -43,7 +43,18 @@ protected override void OnMouseDown(MouseEventArgs mevent)
|
|||
|
||||
if (Menu != null && mevent.Button == MouseButtons.Left)
|
||||
{
|
||||
Menu.Show(this, MenuX0 ? 0 : mevent.X, Height);
|
||||
Point menuLocation;
|
||||
|
||||
if (ShowMenuUnderCursor)
|
||||
{
|
||||
menuLocation = mevent.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
menuLocation = new Point(0, Height);
|
||||
}
|
||||
|
||||
Menu.Show(this, menuLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +62,8 @@ protected override void OnPaint(PaintEventArgs pevent)
|
|||
{
|
||||
base.OnPaint(pevent);
|
||||
|
||||
if (Menu != null)
|
||||
{
|
||||
int arrowX = ClientRectangle.Width - 14;
|
||||
int arrowY = ClientRectangle.Height / 2 - 1;
|
||||
|
||||
|
@ -60,3 +73,4 @@ protected override void OnPaint(PaintEventArgs pevent)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -170,7 +170,6 @@ private void InitializeComponent()
|
|||
//
|
||||
resources.ApplyResources(this.mbLoadImage, "mbLoadImage");
|
||||
this.mbLoadImage.Menu = this.cmsLoadImage;
|
||||
this.mbLoadImage.MenuX0 = true;
|
||||
this.mbLoadImage.Name = "mbLoadImage";
|
||||
this.mbLoadImage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
|
1
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
1
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
|
@ -185,7 +185,6 @@ private void InitializeComponent()
|
|||
//
|
||||
resources.ApplyResources(this.btnLanguages, "btnLanguages");
|
||||
this.btnLanguages.Menu = this.cmsLanguages;
|
||||
this.btnLanguages.MenuX0 = true;
|
||||
this.btnLanguages.Name = "btnLanguages";
|
||||
this.btnLanguages.UseVisualStyleBackColor = true;
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue