当前位置: 首页>>代码示例>>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;未经允许,请勿转载。