如题所示。当然,最好不要使用3方控件。如何实现这个功能哪?

解决方案 »

  1.   

    procedure Tform1.Edit2KeyPress(Sender: TObject; var Key: Char);
    begin
      if not (key in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', #8, #13]) then
        key := char(0); //key:=char(' ');//#8是回退键,#13是回车键
      if key = #13 then
      begin
        selectnext(activecontrol, true, true);//跳转到下一个控件
      end;
    end;
      

  2.   

    edit  keypress 
     
    if Not (Key in ['0'..'9','.',#13,Char(vk_delete),Char(vk_back)]) then
        Key:=#0;
    if (Key='.') and (Pos('.',Edit.Text)>0) then key:=#0;
      

  3.   

    为什么不用3方控件。起始FlatStyle挺不错的!里面就有一个FlatSpinEditFloat,就像官方的SpinEdit一样。不过支持浮点数
      

  4.   

    If not ( key in ['0'..'9',#8,#13,#10]) then
       key :=#0;
      

  5.   

    用 MaskEdit 控件啊!
    -------------------
    不好用,输入很不方便的呀!
      

  6.   


    If not ( key in ['0'..'9','.',#8,#13) then   key :=#0;
      

  7.   

    yhyhai() ( ) 信誉:100  2006-07-02 15:49:00  得分: 0  
     
     
       书上都有啊.仔细看、看。
      
     
    什么书?