最近在使用Samples页中的SpinEdit控件时,发现SpinEdit的最大值(MaxValue)和最小值(MinValue)的处理有漏洞。当最大值和最小值相等且不为零时,设置形同虚设;当最大值小于最小值时,SpinEdit的取值为最大值和最小值。查看Spin.pas时发现,SpinEdit的CheckValue函数如下: function TSpinEdit.CheckValue (NewValue: LongInt): LongInt; begin Result := NewValue; if (FMaxValue <> FMinValue) then begin if NewValue < FMinValue then Result := FMinValue else if NewValue > FMaxValue then Result := FMaxValue; end; end; 可见没有对MaxValue = MinValue 且MinValue <> 0 及 MaxValue < MinValue 进行处理。所以在使用SpinEdit控件时应该在程序中对上述两种情况进行必要的处理。