读书人

定义未找到 急该如何解决

发布时间: 2013-08-27 10:20:47 作者: rapoo

定义未找到 急
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”,怎么改?急

好乱的代码..
你都没有Hotkey类,当然访问不到什么东西了,你在哪里搞这份代码的啊,也要完整些啊...
[解决办法]
定义未找到    急该如何解决这个...这个...
[解决办法]
定义未找到    急该如何解决 代码没拷全
[解决办法]
[colo按快捷键
switch (m.Msg)
{
case WM_HOTKEY:
switch (m.WParam.ToInt32())
{
case 100: //按下的是Shift+S
Windows.close(HtmlDocument);//此处填写快捷键响应代码

出现了错误 1 当前上下文中不存在名称“HotKey”,怎么改?急 r=#FF99CC][/color]

读书人网 >C#

热点推荐