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
Post a Comment