本文整理汇总了C#中System.Windows.Forms.ToolStripItem.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItem.Select方法的具体用法?C# ToolStripItem.Select怎么用?C# ToolStripItem.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripItem
的用法示例。
在下文中一共展示了ToolStripItem.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeSelection
internal virtual void ChangeSelection(ToolStripItem nextItem)
{
if (nextItem != null)
{
ToolStripControlHost host = nextItem as ToolStripControlHost;
if (base.ContainsFocus && !this.Focused)
{
this.FocusInternal();
if (host == null)
{
this.KeyboardActive = true;
}
}
if (host != null)
{
if (this.hwndThatLostFocus == IntPtr.Zero)
{
this.SnapFocus(System.Windows.Forms.UnsafeNativeMethods.GetFocus());
}
host.Control.Select();
host.Control.FocusInternal();
}
nextItem.Select();
ToolStripMenuItem item = nextItem as ToolStripMenuItem;
if ((item != null) && !this.IsDropDown)
{
item.HandleAutoExpansion();
}
}
}
示例2: ChangeSelection
internal void ChangeSelection (ToolStripItem nextItem)
{
if (Application.KeyboardCapture != this)
ToolStripManager.SetActiveToolStrip (this, ToolStripManager.ActivatedByKeyboard);
foreach (ToolStripItem tsi in this.Items)
if (tsi != nextItem)
tsi.Dismiss (ToolStripDropDownCloseReason.Keyboard);
ToolStripItem current = GetCurrentlySelectedItem ();
if (current != null && !(current is ToolStripControlHost))
this.FocusInternal (true);
if (nextItem is ToolStripControlHost)
(nextItem as ToolStripControlHost).Focus ();
nextItem.Select ();
if (nextItem.Parent is MenuStrip && (nextItem.Parent as MenuStrip).MenuDroppedDown)
(nextItem as ToolStripMenuItem).HandleAutoExpansion ();
}
示例3: ProcessDuplicateMnemonic
internal virtual void ProcessDuplicateMnemonic(ToolStripItem item, char charCode)
{
if (this.CanProcessMnemonic() && (item != null))
{
this.SetFocusUnsafe();
item.Select();
}
}
示例4: AssignContainerToContextMenuStrip_RecursivelyAssign
/// <summary>
/// Assign ExpressionMemberContainer to each of Context Menu Strip's items that are child to specified item.
/// Item with value equal to current also gets selected.
/// Called from AssignContainerToContextMenuStrip and recursively calls itself.
/// </summary>
/// <param name="item">Current item.</param>
/// <param name="container">Container to be asigned.</param>
/// <param name="currentValue">Item with this value will be selected.</param>
private static void AssignContainerToContextMenuStrip_RecursivelyAssign(ToolStripItem item, ExpressionMemberContainer container, string currentValue)
{
if (!(item is ToolStripMenuItem))
return;
bool itemSelected = false;
foreach (ToolStripItem innerItem in ((ToolStripMenuItem)item).DropDownItems)
{
AssignContainerToContextMenuStrip_RecursivelyAssign(innerItem, container, currentValue);
itemSelected = itemSelected || item.Selected;
}
item.Tag = container;
if (container.Member.ValueDescription.AreEqual(container.Member.ValueToXml(item.Text), currentValue))
item.Select();
}