PDA

View Full Version : سوال: درباره رویداد کلیک



yousefsystem
سه شنبه 02 اسفند 1390, 20:26 عصر
کسی هست بهم بگه که چطوری میشه در رویداد کلیک روی دکمه یکی از دکمه های کیبورد رو فشار بده
بطور مثال میخوام وقتی روی دکمه کلیک میکنم NumLock روشن بشه یا خاموش.

mrbm_2007
سه شنبه 02 اسفند 1390, 20:28 عصر
این رو جستجو کن
SendKey

mrbm_2007
سه شنبه 02 اسفند 1390, 20:30 عصر
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx

private void Form1_DoubleClick(object sender, System.EventArgs e)
{

// Send the enter key; since the tab stop of Button1 is 0, this
// will trigger the click event.
SendKeys.Send("{ENTER}");
}

yousefsystem
سه شنبه 02 اسفند 1390, 21:00 عصر
اگه بخوای چند کلید مانند Alt و Ctrl و Del چطوریه

mrbm_2007
سه شنبه 02 اسفند 1390, 21:14 عصر
اگر همون مطلب (http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx) رو می خوندی می دیدی

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".

To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.



SHIFT:+
CTRL:^
ALT:%

مثلا (Z)% یعنی Alt + Z