ModifierKeys 不存在,尽管使用了 System.Windows.Input
ModifierKeys does not exist, despite System.Windows.Input being used
我正在尝试制作一个使用 OCR 的机器人,但在尝试获取我发现可用的热键库时遇到问题。
它使用 ModifierKeys 枚举作为其中一个函数的参数,但显然“ModifierKeys 不存在”。
我正在使用 System.Windows.Input,它应该有 ModifierKeys,我仔细检查了我在我的项目中引用了 System.Windows(尽管这应该很明显,因为我没有错误)使用 System.Windows.Input,我猜)
这是我当前的代码(错误发生在 var 键):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using mrousavy;
using System.Windows.Input;
using OCRBot.Handlers;
namespace OCRBot
{
class Program
{
static OCRHandler oCRHandler = new OCRHandler();
static void Main(string[] args)
{
Console.Write("!!");
#if DEBUG
Console.WriteLine("\nPress enter to close...");
Console.ReadLine();
#endif
var key = new HotKey(
(ModifierKeys.Control | ModifierKeys.Alt),
Key.S,
this,
delegate {
MessageBox.Show("Ctrl + Alt + S was pressed!");
}
);
while (true)
{
MainLoop();
}
}
static void MainLoop()
{
oCRHandler.ReadWindow();
}
}
}
你要的Reference是WindowsBase获取ModifierKeys,而不是System.Windows。
我正在尝试制作一个使用 OCR 的机器人,但在尝试获取我发现可用的热键库时遇到问题。
它使用 ModifierKeys 枚举作为其中一个函数的参数,但显然“ModifierKeys 不存在”。
我正在使用 System.Windows.Input,它应该有 ModifierKeys,我仔细检查了我在我的项目中引用了 System.Windows(尽管这应该很明显,因为我没有错误)使用 System.Windows.Input,我猜)
这是我当前的代码(错误发生在 var 键):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using mrousavy;
using System.Windows.Input;
using OCRBot.Handlers;
namespace OCRBot
{
class Program
{
static OCRHandler oCRHandler = new OCRHandler();
static void Main(string[] args)
{
Console.Write("!!");
#if DEBUG
Console.WriteLine("\nPress enter to close...");
Console.ReadLine();
#endif
var key = new HotKey(
(ModifierKeys.Control | ModifierKeys.Alt),
Key.S,
this,
delegate {
MessageBox.Show("Ctrl + Alt + S was pressed!");
}
);
while (true)
{
MainLoop();
}
}
static void MainLoop()
{
oCRHandler.ReadWindow();
}
}
}
你要的Reference是WindowsBase获取ModifierKeys,而不是System.Windows。