本文整理匯總了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();
}