// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace E { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private bool w = false; private bool d = false; void MainFormKeyDown(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.W) { w = true; } else if(e.KeyCode == Keys.D) { d = true; } if(w && d) { MessageBox.Show("Du holder W og D nede samtidigt !"); } } void MainFormKeyUp(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.W) { w = false; } else if(e.KeyCode == Keys.D) { d = false; } } } }