lundi 9 mars 2015

Odd visual behavior from ToolStripMenuItem

I've got a Drop Down Menu that is dynamically filled every time it opens, here is the logic that does it:



private void joysticksToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
{
_joysticks = _joystickWrapper.FindDevices(DeviceType.Joystick);
joysticksToolStripMenuItem.DropDownItems.Clear();
foreach (var di in _joysticks)
{
var item = new ToolStripMenuItem(di.ProductName);
item.Checked = di.InstanceGuid == _joystickWrapper.CurrentDeviceInfo.InstanceGuid;
joysticksToolStripMenuItem.DropDownItems.Add(item);
}
}


When I run the application this is what I see:


That cant be right...


The check is in the wrong location and the blue area is too wide.


Any ideas on where to look to fix this? The entire menu is all System.Windows.Forms, no custom visual code in the entire application.


I tried on my current machine (Windows 10 Build 9926) and on my dev server (Server 2012R2) with the same results. I've also compiled this to the NET Framework 4.5 and 4.5.1


EDIT


For those interested, here is the git repo for this project:


http://ift.tt/1AchBV9


Aucun commentaire:

Enregistrer un commentaire