當前位置: 首頁>>代碼示例>>C#>>正文


C# KeysConverter.ConvertFromInvariantString方法代碼示例

本文整理匯總了C#中System.Windows.Forms.KeysConverter.ConvertFromInvariantString方法的典型用法代碼示例。如果您正苦於以下問題:C# KeysConverter.ConvertFromInvariantString方法的具體用法?C# KeysConverter.ConvertFromInvariantString怎麽用?C# KeysConverter.ConvertFromInvariantString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.KeysConverter的用法示例。


在下文中一共展示了KeysConverter.ConvertFromInvariantString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SendRequestInternal

        protected override void SendRequestInternal(string request)
        {
            string[] args = StringUtils.ToStringArray(request, ',');

            string keyCode = "", repeat = "", command = "", windowName = "", remoteName = "";

            int i = 0;
            if (args.Length > i)
                keyCode = args[i++];
            if (args.Length > i)
                repeat = args[i++];
            if (args.Length > i)
                command = args[i++];
            if (args.Length > i)
                windowName = args[i++];
            if (args.Length > i)
                remoteName = args[i++];

            IntPtr hWnd = User32.FindWindow(windowName, null);
            if (hWnd != IntPtr.Zero)
            {
                KeysConverter kc = new KeysConverter();
                Keys k = (Keys)kc.ConvertFromInvariantString(command);
                KeyEventArgs kea = new KeyEventArgs(k);

                // Key down
                int msg = (int)Messages.WM_KEYDOWN;
                User32.PostMessage(hWnd, msg, kea.KeyValue, 0);
            }
        }
開發者ID:rraguso,項目名稱:protone-suite,代碼行數:30,代碼來源:HotkeyOutputPin.cs

示例2: ShortCutDropDownLoop

 private void ShortCutDropDownLoop(ToolStripMenuItem ts)
 {
     for (int i = 0; i < ts.DropDownItems.Count; i++)
     {
         if ((ts.DropDownItems[i].Tag != null) && (ts.DropDownItems[i].Tag.ToString() != ""))
         {
             ToolStripMenuItem item = (ToolStripMenuItem) ts.DropDownItems[i];
             string text = this.ShortCutAdd(this.TagName(item.Tag.ToString()));
             KeysConverter converter = new KeysConverter();
             item.ShortcutKeys = (Keys) converter.ConvertFromInvariantString(text);
         }
         else if ((ts.DropDownItems[i].GetType() == typeof(ToolStripMenuItem)) && (((ToolStripMenuItem) ts.DropDownItems[i]).DropDownItems.Count > 0))
         {
             this.ShortCutDropDownLoop((ToolStripMenuItem) ts.DropDownItems[i]);
         }
     }
 }
開發者ID:huamanhtuyen,項目名稱:VNACCS,代碼行數:17,代碼來源:UserKeySet.cs

示例3: JobKeySet

 private void JobKeySet()
 {
     UserKey key = UserKey.CreateInstance();
     for (int i = 0; i < this.mnJobKey.DropDownItems.Count; i++)
     {
         ToolStripMenuItem item = (ToolStripMenuItem) this.mnJobKey.DropDownItems[i];
         item.Text = "";
         item.ShortcutKeys = Keys.None;
     }
     for (int j = 0; j < key.JobKeyList[0].KeyList.Count; j++)
     {
         ToolStripMenuItem item2 = (ToolStripMenuItem) this.mnJobKey.DropDownItems[j];
         if (key.JobKeyList[0].KeyList[j].Name != "")
         {
             item2.Text = key.JobKeyList[0].KeyList[j].Name;
             KeysConverter converter = new KeysConverter();
             item2.ShortcutKeys = (Keys) converter.ConvertFromInvariantString(key.JobKeyList[0].KeyList[j].Sckey);
         }
         else
         {
             item2.Text = "";
             item2.ShortcutKeys = Keys.None;
         }
     }
     this.uJobMenu1.JobKeySet();
 }
開發者ID:huamanhtuyen,項目名稱:VNACCS,代碼行數:26,代碼來源:MainBase.cs

示例4: ReadXML

        private void ReadXML(string file)
        {
            XElement root = XElement.Load(file);

            int g = 0;

            foreach (Control groupbox in form.Controls)
            {
                if (groupbox is GroupBox)
                {
                    XElement groupboxXML = root.Elements("macro").ElementAt(g);

                    int p = 0;

                    foreach (Control element in groupbox.Controls)
                    {
                        if (element is Panel)
                        {
                            XElement panelXML = groupboxXML.Elements("key_interval").ElementAt(p);

                            foreach (Control field in element.Controls)
                            {
                                if (field is Label)
                                {
                                    if (panelXML.Element("name") != null)
                                        ((Label)field).Text = panelXML.Element("name").Value;
                                }

                                if (field is ComboBox)
                                    ((ComboBox)field).SelectedIndex = (int)Convert.ToInt32(panelXML.Element("key").Value);

                                if (field is NumericUpDown)
                                    ((NumericUpDown)field).Value = (int)Convert.ToInt32(panelXML.Element("interval").Value);
                            }
                            p++;
                        }

                        if (element is CheckBox)
                            ((CheckBox)element).Checked = Convert.ToBoolean(groupboxXML.Element("loop").Value);

                        if (element is TextBoxEX)
                        {
                            XElement key = groupboxXML.Element("activation-key");
                            if (key != null)
                            {
                                TextBoxEX textbox = element as TextBoxEX;
                                KeysConverter kc = new KeysConverter();

                                textbox.BoxKeys = (Keys)kc.ConvertFromInvariantString(key.Element("winkeys").Value);
                                textbox.Text = key.Element("label").Value;
                                textbox.Args = new KeyEventArgs(textbox.BoxKeys);
                            }

                        }
                    }
                    g++;
                }
            }
        }
開發者ID:println,項目名稱:AutoFire_Lineage-csharp,代碼行數:59,代碼來源:Storage.cs

示例5: LoadInternal

        private static void LoadInternal(Stream s)
        {
            using (StreamReader sr = new StreamReader(s))
            {
                KeysConverter kc = new KeysConverter();

                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    string[] fields = line.Split(";".ToCharArray());
                    if (fields.Length >= 2)
                    {
                        OPMShortcut cmd = (OPMShortcut)Enum.Parse(typeof(OPMShortcut), fields[0]);
                        keyCommands[(int)cmd] = new KeyEventArgs((Keys)kc.ConvertFromInvariantString(fields[1]));

                        if (fields.Length >= 3)
                        {
                            altKeyCommands[(int)cmd] = new KeyEventArgs((Keys)kc.ConvertFromInvariantString(fields[2]));
                        }
                        else
                        {
                            altKeyCommands[(int)cmd] = new KeyEventArgs(keyCommands[(int)cmd].KeyData);
                        }
                    }
                }
            }
        }
開發者ID:rraguso,項目名稱:protone-suite,代碼行數:27,代碼來源:ShortcutMapper.cs


注:本文中的System.Windows.Forms.KeysConverter.ConvertFromInvariantString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。