我想在我的 ObjectModel 中使用新的 Key 枚举以避免在此 Dll 中引用 Windows.Forms。 GUI 使用需要 Keys 枚举的类库。
是否可以通过任何方式将 Key 值转换为 Keys 值?
编辑:我刚刚发现我的问题已经在这里被问到并得到回答:How can I convert 'System.Windows.Input.Key' to 'System.Windows.Forms.Keys'?
请您参考如下方法:
您可以使用 KeyInterop.VirtualKeyFromKey Method转换为 Win32 key ,然后直接转换为 winforms key 。
