mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
MenuButton changes
This commit is contained in:
parent
1486c80318
commit
35116b47c8
4 changed files with 21 additions and 11 deletions
|
@ -104,7 +104,6 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.btnImport, "btnImport");
|
resources.ApplyResources(this.btnImport, "btnImport");
|
||||||
this.btnImport.Menu = this.cmsImport;
|
this.btnImport.Menu = this.cmsImport;
|
||||||
this.btnImport.MenuX0 = true;
|
|
||||||
this.btnImport.Name = "btnImport";
|
this.btnImport.Name = "btnImport";
|
||||||
this.btnImport.UseVisualStyleBackColor = true;
|
this.btnImport.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
@ -112,7 +111,6 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.btnExport, "btnExport");
|
resources.ApplyResources(this.btnExport, "btnExport");
|
||||||
this.btnExport.Menu = this.cmsExport;
|
this.btnExport.Menu = this.cmsExport;
|
||||||
this.btnExport.MenuX0 = true;
|
|
||||||
this.btnExport.Name = "btnExport";
|
this.btnExport.Name = "btnExport";
|
||||||
this.btnExport.UseVisualStyleBackColor = true;
|
this.btnExport.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class MenuButton : Button
|
||||||
public ContextMenuStrip Menu { get; set; }
|
public ContextMenuStrip Menu { get; set; }
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool MenuX0 { get; set; }
|
public bool ShowMenuUnderCursor { get; set; }
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseEventArgs mevent)
|
protected override void OnMouseDown(MouseEventArgs mevent)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,18 @@ protected override void OnMouseDown(MouseEventArgs mevent)
|
||||||
|
|
||||||
if (Menu != null && mevent.Button == MouseButtons.Left)
|
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);
|
base.OnPaint(pevent);
|
||||||
|
|
||||||
|
if (Menu != null)
|
||||||
|
{
|
||||||
int arrowX = ClientRectangle.Width - 14;
|
int arrowX = ClientRectangle.Width - 14;
|
||||||
int arrowY = ClientRectangle.Height / 2 - 1;
|
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");
|
resources.ApplyResources(this.mbLoadImage, "mbLoadImage");
|
||||||
this.mbLoadImage.Menu = this.cmsLoadImage;
|
this.mbLoadImage.Menu = this.cmsLoadImage;
|
||||||
this.mbLoadImage.MenuX0 = true;
|
|
||||||
this.mbLoadImage.Name = "mbLoadImage";
|
this.mbLoadImage.Name = "mbLoadImage";
|
||||||
this.mbLoadImage.UseVisualStyleBackColor = true;
|
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");
|
resources.ApplyResources(this.btnLanguages, "btnLanguages");
|
||||||
this.btnLanguages.Menu = this.cmsLanguages;
|
this.btnLanguages.Menu = this.cmsLanguages;
|
||||||
this.btnLanguages.MenuX0 = true;
|
|
||||||
this.btnLanguages.Name = "btnLanguages";
|
this.btnLanguages.Name = "btnLanguages";
|
||||||
this.btnLanguages.UseVisualStyleBackColor = true;
|
this.btnLanguages.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue