在该控件的keypress中限定一下: if not (key in ['0'..'9',#8]) then key:=#0; 设置它的值例如:minvalue:=0,maxvalue:=999999,这样就只能输入或选择正数了 在delphi运行环境中确实有问题,但脱开环境就没有问题了。这可能是delphi的一个bug了。
procedure TForm1.SpinEdit1Exit(Sender: TObject); begin if Spinedit1.Text = '' then Spinedit1.Value:= 0; end;
to ChocoboY(陆行鸟):我开始用的是 if Spinedit1.Text = '' then Spinedit1.Value:=100; 现在好了,或许我修改时不小心发生了错误.谢谢!!!
if not (key in ['0'..'9',#8]) then
key:=#0;
设置它的值例如:minvalue:=0,maxvalue:=999999,这样就只能输入或选择正数了
在delphi运行环境中确实有问题,但脱开环境就没有问题了。这可能是delphi的一个bug了。
begin
if Spinedit1.Text = '' then
Spinedit1.Value:= 0;
end;
if Spinedit1.Text = '' then
Spinedit1.Value:=100;
现在好了,或许我修改时不小心发生了错误.谢谢!!!