C#NumericUpDown按钮箭头 [英] C# NumericUpDown Button Arrows

查看:84
本文介绍了C#NumericUpDown按钮箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试创建一个NumericUpDown按钮,但看不到任何有关按下哪个按钮的事件(我的意思是向上或向下).如何查看用户按下了哪个按钮?

Hello I am trying to create a NumericUpDown Button but I can't see any events referring to which button is pressed (Up or Down I mean). How can I check which button the user pressed?

推荐答案

     var oldValue = numericUpDown1.Value;
        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
          var newValue=  numericUpDown1.Value;

          if (oldValue < newValue))
          {
              // this is up button
          }
          else
          {
              //this is down button
          }
        }

这可能会对您有所帮助.我没有写%100正确,例如,您必须将新值转换为int和blabla.但是逻辑就是这样.您必须订阅numericupdown valuechanged事件

this may help you. I didnt write %100 correct for example you have to convert new value to int and blabla. But logic is that. You have to subscribe to numericupdown valuechanged event

这篇关于C#NumericUpDown按钮箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆