internal void CreateToolStrip()
{
if (Enabled == false)
{
return;
}
if (dropDownItems.Count == 0)
{
return;
}
var dropDownBounds = new Rectangle(Point.Empty, Owner.Size);
for (int i = 0; i < dropDownItems.Count; i++) // Reset items.
{
var item = dropDownItems[i];
item.Unselect();
var dropDownItem = item as ToolStripDropDownItem;
if (dropDownItem == null)
{
continue;
}
dropDownItem.ArrowImage = ApplicationResources.Images.DropDownRightArrow;
dropDownItem.ArrowColor = Color.Black;
}
var direction = ToolStripDropDownDirection.Right;
if (Owner.IsDropDown == false)
{
direction = ToolStripDropDownDirection.BelowRight;
}
dropDownToolStrip = userDropDown == null
? new ToolStripDropDownMenu()
: userDropDown;
dropDownToolStrip.OwnerItem = this;
dropDownToolStrip.Items.AddRange(dropDownItems);
dropDownToolStrip.selectedItem = dropDownToolStrip.SelectNextToolStripItem(null, true);
dropDownToolStrip.shouldFixWidth = true;
dropDownToolStrip.direction = direction;
dropDownToolStrip.Location = DropDownDirectionToDropDownBounds(direction, dropDownBounds).Location;
dropDownToolStrip.Disposed += DropDownToolStrip_Disposed;
dropDownToolStrip.Show(dropDownToolStrip.Location);
if (uwfDropDownCreated != null)
{
uwfDropDownCreated(dropDownToolStrip);
}
pressed = true;
}