在C#中,我如何知道我键入的NumericUpDown值因超出边界而被更改?

在C#中,我如何知道我键入的NumericUpDown值因超出边界而被更改?,c#,numericupdown,C#,Numericupdown,我在我的程序中使用了一对数字上下:num_Max和num_Min。 并使用验证它们的更改边界 private void num_Validating(object sender, CancelEventArgs e){ if((sender as NumericUpDown) == num_min) num_max.Minimum = num_min.Value; if((sender as NumericUpDown) == num_max) num_min.Maximum = num

我在我的程序中使用了一对数字上下:num_Max和num_Min。 并使用验证它们的更改边界

private void num_Validating(object sender, CancelEventArgs e){
    if((sender as NumericUpDown) == num_min)
num_max.Minimum = num_min.Value;
if((sender as NumericUpDown) == num_max)
num_min.Maximum = num_max.Value;
}

当num_max.Minimum=10且用户输入为7时,我想显示消息“值已更改,原因超出范围!”。我该怎么做呢?

在人们开始玩你的数字游戏之前,你一定要设置最小值/最大值。不是在验证过程中,那么它将为您处理最小/最大值是工作。我想知道num_max.Minimum=10,用户输入7,NumericUpDown是否将其更改为10。我想知道用户输入的是7而不是10。然后不要设置最小值/最大值,这样他们可以键入他们想要的内容并进行验证,在取消验证之前,您将拥有当前值,因此我需要自己更改值?@H.C。您可能需要一个覆盖
ParseEdit
的派生类,因为这是负责检查值的方法。但是,请参见,如果您使用NUMUPDOWN来定义应用程序的最大/最小值,那么为什么它们首先会有边界?闻起来像是架构中的一个问题。