本文整理汇总了C#中ModifierKeys.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ModifierKeys.ToString方法的具体用法?C# ModifierKeys.ToString怎么用?C# ModifierKeys.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModifierKeys
的用法示例。
在下文中一共展示了ModifierKeys.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetKeyAndModifier
private void SetKeyAndModifier(ModifierKeys modifier, Keys key)
{
this.currentModifier = modifier;
this.currentKey = key;
string keyString = key.ToString();
if (key == Keys.End)
keyString = "End";
command_box.Text = modifier.ToString() + " + " + keyString;
}
示例2: ToName
public static string ToName(ModifierKeys modifierKeys, Key key)
{
string modifierkey_txt = modifierKeys == ModifierKeys.None ? string.Empty : modifierKeys.ToString(),
key_txt = key == Key.None ? string.Empty : key.ToString();
var keyText = string.Format("{0}{1}{2}",
modifierkey_txt,
(modifierKeys == ModifierKeys.None || key == Key.None) ? string.Empty : ",", key_txt);
keyText = keyText.Replace(",", " + ");
return keyText;
}
示例3: RegisterHotKey
/// <summary>
/// Registers a hot key in the system.
/// </summary>
/// <param name="modifier">The modifiers that are associated with the hot key.</param>
/// <param name="key">The key itself that is associated with the hot key.</param>
public void RegisterHotKey(ModifierKeys modifier, Keys key)
{
//MessageBox.Show("Modifier: " + modifier.ToString() + "Key: "+ key.ToString());
// increment the counter.
_currentId = _currentId + 1;
// register the hot key.
if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key))
throw new InvalidOperationException("Unable to register the hotkey " + modifier.ToString() + " "+ key.ToString() + ". Please choose a different one (or find the key or program that has registered it already).");
}
示例4: SetKeyModifierStart
public static void SetKeyModifierStart(ModifierKeys mods)
{
toggl_set_key_modifier_start(ctx, mods.ToString());
}