本文整理汇总了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);
}
}
示例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]);
}
}
}
示例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();
}
示例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++;
}
}
}
示例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);
}
}
}
}
}