Key conversion

Hi, could someone explain to me what this code means and how it works? 🙂 I found it on Stackoverflow and I really really need it but I can't for the life of me figure out what it is.

Keys formsKey = ...; Key wpfKey = ...; wpfKey = KeyInterop.KeyFromVirtualKey((int)formsKey); formsKey = (Keys)KeyInterop.VirtualKeyFromKey(wpfKey); 

PS: I need to convert Keys to get this to work

private void movement(object sender, System.Windows.Input.KeyEventArgs key) { if (key.KeyCode = Keys.Up) { x -= 20; } .... 

KeyCode doesn't work so need to convert 🙂

by Unownist via /r/csharp

Leave a Reply