c# - How to use Numlock keys in calculator -


i writing program of simple calculator. able make calculator, entering through mouse clicks.

i wanted know how use numlock keys entering numbers.

it can little tedious, assuming application wpf, here's overview of user input msdn.

the important part window definition (the xaml) can keydown event handler assigned. if add it, when hit =, should given opportunity have method created. that, , can figure out key pressed , it. msdn example of looks this:

private void onbuttonkeydown(object sender, keyeventargs e) {     button source = e.source button;     if (source != null)     {         if (e.key == key.left)         {             source.background = brushes.lemonchiffon;         }         else         {             source.background = brushes.aliceblue;         }     } } 

i don't recommend color thing, myself, can connect logic use buttons, instead, too, if wanted.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -