日期:2014-05-18 浏览次数:21494 次
if (e.KeyCode == Keys.F1 || e.KeyCode == Keys.F2) { if ((GetKeyState(0x70) & 0X80) == 0X80 && (GetKeyState(0x71) & 0X80) == 0X80) MessageBox.Show("按下了F1和F2"); }
------解决方案--------------------
//在from窗体的事件中找到keydown 双击进入编辑键入如下代码 /// <summary> /// 窗体键盘事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Control)//用户是否按下了Ctrl键 { if (e.KeyCode == Keys.C) { //用户按下了Ctrl+C. } } } //改代码只有在改窗体获得焦点时可用.
------解决方案--------------------
哦,没试过……,自己可以百度
------解决方案--------------------
不知道啊,帮顶。。。
------解决方案--------------------
先判断是否按了ctrl+c,如果按了,然后再FILE.COPY
看下其他的答案。
------解决方案--------------------
键盘钩子事件
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.Windows.Forms; namespace Freemansoft.MeetingClient.Helps { #region 定义结构 public enum WH_Codes : int { /// <summary> /// 底层键盘钩子 /// </summary> WH_KEYBOARD_LL = 13, /// <summary> /// 底层鼠标钩子 /// </summary> WH_MOUSE_LL = 14 } public enum WM_MOUSE : int { /// <summary> /// 鼠标开始 /// </summary> WM_MOUSEFIRST = 0x200, /// <summary> /// 鼠标移动 /// </summary> WM_MOUSEMOVE = 0x200, /// <summary> /// 左键按下 /// </summary> WM_LBUTTONDOWN = 0x201, /// <summary> /// 左键释放 /// </summary> WM_LBUTTONUP = 0x202, /// <summary> /// 左键双击 /// </summary> WM_LBUTTONDBLCLK = 0x203, /// <summary> /// 右键按下 /// </summary> WM_RBUTTONDOWN = 0x204, /// <summary> /// 右键释放 /// </summary> WM_RBUTTONUP = 0x205, /// <summary> /// 右键双击 /// </summary> WM_RBUTTONDBLCLK = 0x206, /// <summary> /// 中键按下 /// </summary> WM_MBUTTONDOWN = 0x207, /// <summary> /// 中键释放 /// </summary> WM_MBUTTONUP = 0x208, /// <summary> /// 中键双击 /// </summary> WM_MBUTTONDBLCLK = 0x209, /// <summary> /// 滚轮滚动 /// </summary> /// <remarks>WINNT4.0以上才支持此消息</remarks> WM_MOUSEWHEEL = 0x020A } public enum WM_KEYBOARD : int { /// <summary> /// 非系统按键按下 /// </summary> WM_KEYDOWN = 0x100, /// <summary> /// 非系统按键释放 /// </summary> WM_KEYUP = 0x101, /// <summary> /// 系统按键按下 /// </summary> WM_SYSKEYDOWN = 0x104, /// <summary> /// 系统按键释放 /// </summary> WM_SYSKEYUP = 0x105 } /// <summary> /// 键盘钩子事件结构定义 /// </summary> /// <remarks>详细说明请参考MSDN中关于 KBDLLHOOKSTRUCT 的说明</remarks> [StructLayout(LayoutKind.Sequential)] public struct KeyboardHookStruct { /// <summary> /// Specifies a virtual-key