当前位置: 首页>>代码示例>>C#>>正文


C# Keys.ToString方法代码示例

本文整理汇总了C#中Keys.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Keys.ToString方法的具体用法?C# Keys.ToString怎么用?C# Keys.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Keys的用法示例。


在下文中一共展示了Keys.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: A

		public bool A(Keys keys)
		{
			TimeSpan timeSpan = DateTime.Now.Subtract(this.A);
			this.A = DateTime.Now;
			if (this.A == keys.ToString() && timeSpan.TotalMilliseconds < 100.0)
			{
				return true;
			}
			this.A = keys.ToString();
			return false;
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:11,代码来源:C.cs

示例2: ToAscii

        private static string ToAscii(Keys key)
        {
            if (key.ToString().ToLower().Contains("oem"))
            {
                var outputBuilder = new StringBuilder(2);

                int result = ToAscii((uint)key, 0, new byte[0], outputBuilder, 0);
                if (result == 1)
                    return (outputBuilder[0].ToString()).ToUpper();
            }
            return key.ToString();
        }
开发者ID:println,项目名称:AutoFire_Lineage-csharp,代码行数:12,代码来源:ASCII.cs

示例3: keyChar

 public static char keyChar(Keys key)
 {
     if (key == Keys.Space)
         return ' ';
     else if (key == Keys.OemMinus)
         return '-';
     else if (isKeyDigit(key))
         return key.ToString().ElementAt<char>(1);
     else if (isKeyLetter(key))
         return key.ToString().ElementAt<char>(0);
     else
         return '\0';
 }
开发者ID:nlacombe42,项目名称:forgottenschism,代码行数:13,代码来源:InputHandler.cs

示例4: SequenceKeyData

 public override byte[] SequenceKeyData(Keys modifier, Keys key)
 {
     if((int)Keys.F1 <= (int)key && (int)key <= (int)Keys.F12)
         return base.SequenceKeyData(modifier, key);
     else if(GUtil.IsCursorKey(key))
         return base.SequenceKeyData(modifier, key);
     else {
         byte[] r = new byte[4];
         r[0] = 0x1B;
         r[1] = (byte)'[';
         r[3] = (byte)'~';
         //���̂������xterm�ł͊��ƈႤ�悤��
         if(key==Keys.Insert)
             r[2] = (byte)'2';
         else if(key==Keys.Home)
             r[2] = (byte)'1';
         else if(key==Keys.PageUp)
             r[2] = (byte)'5';
         else if(key==Keys.Delete)
             r[2] = (byte)'3';
         else if(key==Keys.End)
             r[2] = (byte)'4';
         else if(key==Keys.PageDown)
             r[2] = (byte)'6';
         else
             throw new ArgumentException("unknown key " + key.ToString());
         return r;
     }
 }
开发者ID:VirusFree,项目名称:VFTerminal,代码行数:29,代码来源:XTerm.cs

示例5: Register

        /// <summary> register the key hook </summary>
        public void Register(Keys hotkey, int modifiers)
        {
            Unregister();

            try
            {
                // use the GlobalAddAtom API to get a unique ID (as suggested by MSDN docs)
                String atomName = Thread.CurrentThread.ManagedThreadId.ToString("X8") + this.GetType().FullName + hotkey.ToString();
                this.KeyID = GlobalAddAtom(atomName);

                if (this.KeyID == 0)
                {
                    throw new Exception("Unable to generate unique hotkey ID. Error: " + Marshal.GetLastWin32Error().ToString());
                }

                // register the hotkey, throw if any error
                if (!RegisterHotKey(this.handle, (int)this.KeyID, modifiers, (int)hotkey))
                {
                    throw new Exception("Unable to register hotkey. Error: " + Marshal.GetLastWin32Error().ToString());
                }

            }
            catch (Exception e)
            {
                Log.Write(e);
                Unregister();
            }
        }
开发者ID:e-Deniska,项目名称:iPlaylist,代码行数:29,代码来源:KeyHook.cs

示例6: KeyToString

 public static String KeyToString(Keys key)
 {
     switch (key)
     {
         case Keys.D1:
             return "1";
         case Keys.D2:
             return "2";
         case Keys.D3:
             return "3";
         case Keys.D4:
             return "4";
         case Keys.D5:
             return "5";
         case Keys.D6:
             return "6";
         case Keys.D7:
             return "7";
         case Keys.D8:
             return "8";
         case Keys.D9:
             return "9";
         case Keys.D0:
             return "0";
         case Keys.LButton:
             return Locale.Resource.GenLeftMouse;
         case Keys.RButton:
             return Locale.Resource.GenRightMouse;
         case Keys.MButton:
             return Locale.Resource.GenMiddleMouse;
         case Keys.None:
             return "";
     }
     return key.ToString();
 }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:35,代码来源:Util.cs

示例7: MainFormKeyPressedEvent

        /// <summary>
        /// перехват нажимания кнопок
        /// </summary>
        /// <param name="key">Нажатая кнопка</param>
        void MainFormKeyPressedEvent(Keys key)
        {
            var mod = Enum.GetValues(typeof(Keys)).Cast<Keys>().Where(x => ModifierKeys.ToString().Split(',').Select(y => y.Trim()).Contains(x.ToString())).ToArray();
            curentMod1Key = mod.Length > 0 ? mod[0] : Keys.None;
            curentMod2Key = mod.Length > 1 ? mod[1] : Keys.None;

            if (key != Keys.ControlKey && key != Keys.ShiftKey)
            {
                ObjHotKey.mainKey = key;
                ObjHotKey.mod1 = curentMod1Key;
                ObjHotKey.mod2 = curentMod2Key;

                var sb = new StringBuilder(key.ToString());
                if (curentMod1Key != Keys.None && curentMod1Key != null)
                {
                    sb.Append(string.Format(" + {0}", curentMod1Key));
                    ObjHotKey.mod1 = curentMod1Key;
                }
                if (curentMod2Key != Keys.None && curentMod2Key != null)
                {
                    sb.Append(string.Format(" + {0}", curentMod2Key));
                    ObjHotKey.mod2 = curentMod2Key;
                }

                txtbxHotKeyNewValue.Text = sb.ToString();
            }
        }
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:31,代码来源:HotKeySetForm.cs

示例8: KeyboardProcessing

        // Protected Methods (1)
        protected void KeyboardProcessing(Keys keyData)
        {
            if (player.profile.userCanPressArrows && (player.gameState == GameState.Paused || player.gameState == GameState.BeforeFirstMove))
            {
                player.Pause();
            }

            if (player.profile.userCanPressArrows && player.gameState == GameState.Running && isKeyDown == false)
            {
                if (keyData == Keys.Down || keyData == Keys.Up || keyData == Keys.Left || keyData == Keys.Right)
                {
                    Int64 whenMovementIsPossible = Math.Max(player.gameDesk.pSokoban.model.Time, player.gameDesk.pSokoban.TimeMovementEnds);
                    Debug("(key pressed " + keyData.ToString() + " at time " + player.gameDesk.pSokoban.model.Time.ToString() + ")", "Keyboard");
                    repeatedSokobanEvent = Keys2EventType(keyData);

                    if (player.gameDesk.pSokoban.MovementInProgress == false)
                    {
                        player.gameDesk.pSokoban.model.MakePlan(player.model.time, player.gameDesk.pSokoban, repeatedSokobanEvent);
                        player.gameDesk.pSokoban.MovementInProgress = true;
                    }
                }

                DEBUG_KeysProcessing(keyData);
            }
        }
开发者ID:MartyIX,项目名称:SoTh,代码行数:26,代码来源:Keyboard.cs

示例9:

 public string this[Keys key]
 {
     get
     {
         return _data[key.ToString()];
     }
 }
开发者ID:jbruchanov,项目名称:ZumpaReader-WinPhone,代码行数:7,代码来源:ZumpaReaderResources.cs

示例10: SetValue

		private static void SetValue(Keys keys, object value)
		{
			if (value == null)
				value = string.Empty;

			Registry.SetValue(APP_KEY, keys.ToString(), value.ToString());
		}
开发者ID:TargetProcess,项目名称:Tp.TrayUtility,代码行数:7,代码来源:SettingsManager.cs

示例11: keyboard

 public override String keyboard(Keys keyCode, int x, int y)
 {
     StringBuilder result = new StringBuilder();
     switch (keyCode)
     {
     case Keys.B:
         boneToUpdate++;
         if (boneToUpdate > (bones.Count - 1))
         {
             boneToUpdate = 0;
         }
         result.AppendLine("boneToUpdate = " + boneToUpdate.ToString());
         break;
     case Keys.D1:  Rotate(Vector3.UnitX, 5f);   break;
     case Keys.D2:  Rotate(Vector3.UnitX, -5f);  break;
     case Keys.D3:  Rotate(Vector3.UnitY, 5f);   break;
     case Keys.D4:  Rotate(Vector3.UnitY, -5f);  break;
     case Keys.D5:  Rotate(Vector3.UnitZ, 5f);   break;
     case Keys.D6:  Rotate(Vector3.UnitZ, -5f);  break;
     case Keys.D7:  Scale(new Vector3(0.9f, 0.9f, 0.9f));  break;
     case Keys.D8:  Scale(new Vector3(1.1f, 1.1f, 1.1f));  break;
     case Keys.D9:  Move(new Vector3(0.1f, 0.1f, 0.1f));  break;
     case Keys.D0:  Move(new Vector3(-0.1f, -0.1f, -0.1f));  break;
     case Keys.I:
         foreach(Bone b in bones)
         {
             result.Append(b.GetBoneInfo());
         }
         break;
     }
     result.AppendLine(keyCode.ToString());
     return result.ToString();
 }
开发者ID:j1s1e1,项目名称:GlslMonoOpenTkExamples,代码行数:33,代码来源:Tut_Skeleton.cs

示例12: ProcessCmdKey

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (waitLabel != null)
            {
                if (!keyData.HasFlag(Keys.Control) && !keyData.HasFlag(Keys.Alt) && !keyData.HasFlag(Keys.Shift))
                {
                    switch (waitKey)
                    {
                        case GameInput.Up: GameInputKeys.Up = keyData; break;
                        case GameInput.Down: GameInputKeys.Down = keyData; break;
                        case GameInput.Left: GameInputKeys.Left = keyData; break;
                        case GameInput.Right: GameInputKeys.Right = keyData; break;
                        case GameInput.Jump: GameInputKeys.Jump = keyData; break;
                        case GameInput.Shoot: GameInputKeys.Shoot = keyData; break;
                        case GameInput.Start: GameInputKeys.Start = keyData; break;
                        case GameInput.Select: GameInputKeys.Select = keyData; break;
                    }
                    waitLabel.Text = keyData.ToString();
                    waitLabel = null;
                    return true;   // Needs to be here, so if a key picked like up, selected button must not be changed.
                }
                else
                {
                    string key = "";

                    if (keyData.HasFlag(Keys.Control)) key = "ctrl";
                    else if (keyData.HasFlag(Keys.Alt)) key = "Alt";
                    else if (keyData.HasFlag(Keys.Shift)) key = "Shift";

                    MessageBox.Show(this, "Key " + key + " is not allowed.", "Unhauthorized key", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                }
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
开发者ID:Tesserex,项目名称:C--MegaMan-Engine,代码行数:34,代码来源:Keyboard.cs

示例13: HotkeyForm

 public HotkeyForm()
 {
     InitializeComponent();
     MainForm.HotkeyEnabled = false;
     switch (MainForm.HotkeyAction)
     {
         case HotkeyActions.AddStart:
             radioButton_AddStart.Checked = true;
             break;
         case HotkeyActions.AddEnd:
             radioButton_AddEnd.Checked = true;
             break;
         case HotkeyActions.AddRange:
             radioButton_AddRange.Checked = true;
             break;
         case HotkeyActions.SubStart:
             radioButton_SubStart.Checked = true;
             break;
         case HotkeyActions.SubEnd:
             radioButton_SubEnd.Checked = true;
             break;
         case HotkeyActions.SubRange:
             radioButton_SubRange.Checked = true;
             break;
     }
     Hotkey = MainForm.Hotkey;
     label_HotkeyKey.Text = Hotkey.ToString();
 }
开发者ID:Cth1003,项目名称:VRC,代码行数:28,代码来源:HotkeyForm.cs

示例14: GetValueOf

 public static string GetValueOf(Keys k)
 {
     if ((int)k >= 65 && (int)k <= 90)
     {
         return k.ToString().ToLower();
     }
     else if (k == (Keys)48 || k == (Keys)96)
     {
         return "0";
     }
     else if (k == (Keys)49 || k == (Keys)97)
     {
         return "1";
     }
     else if (k == (Keys)50 || k == (Keys)98)
     {
         return "2";
     }
     else if (k == (Keys)51 || k == (Keys)99)
     {
         return "3";
     }
     else if (k == (Keys)52 || k == (Keys)100)
     {
         return "4";
     }
     else if (k == (Keys)53 || k == (Keys)101)
     {
         return "5";
     }
     else if (k == (Keys)54 || k == (Keys)102)
     {
         return "6";
     }
     else if (k == (Keys)55 || k == (Keys)103)
     {
         return "7";
     }
     else if (k == (Keys)56 || k == (Keys)104)
     {
         return "8";
     }
     else if (k == (Keys)57 || k == (Keys)105)
     {
         return "9";
     }
     else if (k == (Keys)57 || k == (Keys)106)
     {
         return "9";
     }
     else if (k == (Keys)110)
     {
         return ".";
     }
     else
     {
         return "";
     }
 }
开发者ID:nbarray,项目名称:animaltactics4,代码行数:59,代码来源:Input.cs

示例15: OptionsForm

 public OptionsForm(Keys increaseHotkey, Keys decreaseHotkey)
 {
     InitializeComponent();
       increaseHotkeyBox.Text = increaseHotkey.ToString();
       IncreaseHotkey = increaseHotkey;
       decreaseHotkeyBox.Text = decreaseHotkey.ToString();
       DecreaseHotkey = decreaseHotkey;
 }
开发者ID:kerv,项目名称:simcity-speedbooster,代码行数:8,代码来源:OptionsForm.cs


注:本文中的Keys.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。