Example #1
0
        public static Char GetKeyChar(KeyEventArgs e)
        {
            UInt32 info;

            if ((int)e.KeyCode < KeyInfoTable.Length)
            {
                info = KeyInfoTable[(int)e.KeyCode];
            }
            else
            {
                if (!KeyInfoMap.TryGetValue(e.KeyCode, out info))
                {
                    KeyInfoMap.Add(e.KeyCode, 0);
                    info = 0;
                }
            }

            Char c = (Char)(info & 0xFF);

            if ((info & (uint)KeyFlags.IsAlpha) != 0)
            {
                if (e.Shift)
                {
                    c = (Char)(c + 'A' - 'a');
                }
            }
            return(c);
        }
Example #2
0
 static void SetInfo(Keys key, Char c, KeyFlags flags)
 {
     if ((int)key < KeyInfoTable.Length)
     {
         KeyInfoTable[(int)key] = (uint)flags | c;
     }
     else
     {
         KeyInfoMap.Add(key, (uint)flags | c);
     }
 }
Example #3
0
 static void SetInfo(Keys key, Char c)
 {
     if ((int)key < KeyInfoTable.Length)
     {
         KeyInfoTable[(int)key] = c;
     }
     else
     {
         KeyInfoMap.Add(key, c);
     }
 }
Example #4
0
 static void SetInfo(Keys key)
 {
     if ((int)key < KeyInfoTable.Length)
     {
         KeyInfoTable[(int)key] = 0;
     }
     else
     {
         KeyInfoMap.Add(key, 0);
     }
 }