I have a maximized Form
with a ToolStrip
docked to the right border. Its Padding
is set to 0. According to Fitt's Law, it would be nice if the user was able to click the ToolStripButton
s at the screen edge. However, the rightmost pixel is not clickable, my button reacts only when I move the cursor one pixel to the left. So how can I fix this?
Things that don't work #1: If you uncomment the LayoutStyle = ...
line below, the buttons become clickable even at the rightmost pixel, but overflowing does not work any more (so this is not a solution).
Things that don't work #2: As my real application is an MDI application, I cannot just change Dock
to None
and position the ToolStrip
manually without messing up the MDI client area (so this is not a solution either).
using System.Windows.Forms;
namespace ToolStripPaddingTest
{
class Program
{
static void Main(string[] args)
{
Form f = new Form() { WindowState = FormWindowState.Maximized };
ToolStrip t = new ToolStrip() { Dock = DockStyle.Right
, Padding = new Padding(0)
// , LayoutStyle = ToolStripLayoutStyle.Table
};
ToolStripItem[] tsi = new ToolStripItem[100];
for(int i = 0; i < 100; ++i)
tsi[i] = new ToolStripButton("Test")
{ TextDirection = ToolStripTextDirection.Vertical90 };
t.Items.AddRange(tsi);
f.Controls.Add(t);
f.ShowDialog();
}
}
}