日期:2014-05-17  浏览次数:20811 次

定义未找到 急
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using System.Drawing;
using System.Data;

namespace ClassLibrary4

{
 
    public partial class Hotkey
    {

      private void Form_Activated(object sender, EventArgs e)
{

     //注册热键Shift+S,Id号为100。HotKey.KeyModifiers.Shift也可以直接使用数字4来表示。
     HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.ESC, 0); 
     //注册热键Ctrl+B,Id号为101。HotKey.KeyModifiers.Ctrl也可以直接使用数字2来表示。
     HotKey.RegisterHotKey(Handle, 101, HotKey.KeyModifiers.Ctrl, Keys.B);
     //注册热键Alt+D,Id号为102。HotKey.KeyModifiers.Alt也可以直接使用数字1来表示。
     HotKey.RegisterHotKey(Handle, 102, HotKey.KeyModifiers.Alt, Keys.D);
}

//在FormA的Leave事件中注销热键。

    
    
    private void FrmSale_Leave(object sender, EventArgs e)
{
     //注销Id号为100的热键设定
     HotKey.UnregisterHotKey(Handle, 100);
     //注销Id号为101的热键设定
     HotKey.UnregisterHotKey(Handle, 101);
     //注销Id号为102的热键设定
     HotKey.UnregisterHotKey(Handle, 102);
}
     }
    public partial class Button : Form
   {
     protected override void WndProc(ref Message m)
 {
     const int WM_Hotkey = 0x0312;
     //按快捷键
     switch (m.Msg)
     {
         case WM_HOTKEY:
             switch (m.WParam.ToInt32())
             {
                 case 100:     //按下的是Shift+S
                     Windows.close(HtmlDocument);//此处填写快捷键响应代码     

出现了错误 1 当前上下文中不存在名称“HotKey”,怎么改?急