本文整理汇总了C#中Shortcut.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Shortcut.Equals方法的具体用法?C# Shortcut.Equals怎么用?C# Shortcut.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shortcut
的用法示例。
在下文中一共展示了Shortcut.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestShortcut
protected bool TestShortcut(Shortcut sc)
{
bool result = false;
// Must have an active leaf for shortcuts to operate against
if (_activeLeaf != null)
{
Controls.TabControl tc = _activeLeaf.GroupControl as Controls.TabControl;
// Must have an active tab for these shortcuts to work against
if (tc.SelectedTab != null)
{
// Close selected page requested?
if (sc.Equals(_closeShortcut))
{
_activeLeaf.OnClose(_activeLeaf, EventArgs.Empty);
result = true;
}
// Toggle the prominence state?
if (sc.Equals(_prominentShortcut))
{
_activeLeaf.OnToggleProminent(_activeLeaf, EventArgs.Empty);
result = true;
}
// Move page to the next group?
if (sc.Equals(_moveNextShortcut))
{
_activeLeaf.OnMoveNext(_activeLeaf, EventArgs.Empty);
result = true;
}
// Move page to the previous group?
if (sc.Equals(_movePreviousShortcut))
{
_activeLeaf.OnMovePrevious(_activeLeaf, EventArgs.Empty);
result = true;
}
// Cannot split a group unless at least two entries exist
if (tc.TabPages.Count > 1)
{
bool allowVert = false;
bool allowHorz = false;
if (_root.Count <= 1)
{
allowVert = true;
allowHorz = true;
}
else
{
if (_root.Direction == Direction.Vertical)
allowVert = true;
else
allowHorz = true;
}
// Create two vertical groups
if (allowHorz && sc.Equals(_splitVerticalShortcut))
{
_activeLeaf.NewHorizontalGroup(_activeLeaf, false);
result = true;
}
// Create two horizontal groups
if (allowVert && sc.Equals(_splitHorizontalShortcut))
{
_activeLeaf.NewVerticalGroup(_activeLeaf, false);
result = true;
}
}
}
// Request to rebalance all spacing
if (sc.Equals(_rebalanceShortcut))
{
_activeLeaf.OnRebalance(_activeLeaf, EventArgs.Empty);
result = true;
}
}
return result;
}