gpt4 book ai didi

c# - c#中数值递增的问题

转载 作者:行者123 更新时间:2023-11-30 12:36:53 24 4
gpt4 key购买 nike

我在我的表单中使用了数字 updown,

如果我改变这个值本身,一个事件应该引发,(例如:如果我在数值上升中将值从 6 更改为 7,则应该引发一个事件)我为此使用了 ValueChange 事件,但只有在鼠标滚轮或微调按钮上的值发生变化时才会引发该事件。如果我用键盘在数字向上输入值,该事件没有引发。

最佳答案

根据 MSDN:

For the ValueChanged event to occur, the Value property can be changed in code, by clicking the up or down button, or by the user entering a new value that is read by the control. The new value is read when the user hits the ENTER key or navigates away from the control. If the user enters a new value and then clicks the up or down button, the ValueChanged event will occur twice.

因此用户需要按 Enter,如果这不是一个选项,请使用 KeyPress 事件

TextChanged事件,但有一个免责声明

This event supports the .NET Framework infrastructure and is not intended to be used directly from your code.

关于c# - c#中数值递增的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2386300/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com