If screen smaller than toolbar width then move menu to top left corner

This commit is contained in:
Jaex 2016-10-01 14:13:54 +03:00
parent b243116c75
commit 56cf767ab7

View file

@ -67,11 +67,10 @@ private void CreateMenu()
Dock = DockStyle.None,
GripStyle = ToolStripGripStyle.Hidden,
Location = new Point(0, 0),
MinimumSize = new Size(100, 30),
MinimumSize = new Size(600, 30),
Padding = new Padding(0, 0, 0, 0),
Renderer = new CustomToolStripProfessionalRenderer(),
TabIndex = 0,
Text = "ToolStrip"
TabIndex = 0
};
tsMain.SuspendLayout();
@ -609,7 +608,15 @@ private void CreateMenu()
menuForm.Show(form);
Rectangle rect = CaptureHelpers.GetActiveScreenBounds0Based();
menuForm.Location = new Point(rect.X + rect.Width / 2 - tsMain.Width / 2, rect.Y + 20);
if (rect.Width > tsMain.Width)
{
menuForm.Location = new Point(rect.X + rect.Width / 2 - tsMain.Width / 2, rect.Y + 20);
}
else
{
menuForm.Location = rect.Location;
}
form.Activate();