我想只能在edit1中输入数字,有这个属性吗,找了半天没找到?

解决方案 »

  1.   

    可以自己写代码控制,或者用LMD的MaskEdit控件,有这种属性
      

  2.   

    仅仅是数字的话,本身的MaskEdit就可以
      

  3.   

    美哟,直接
    SetWindowLong(Edit1.Handle, GWL_STYLE,
                      GetWindowLong(Edit1.Handle, GWL_STYLE) or
                      ES_NUMBER);   
    就可以了
      

  4.   

    onkeypress
    if not (key in ['0'..'9',#8]) then
      key:=#0;
      

  5.   

    *******onkeypress  ***********if Key = #8 then
         exit;  if (Key < '0') or (Key > '9') then Key := #10;
      

  6.   

    你可以利用控件的涵数
    procedure TForm1.editKeyPress(Sender: TObject; var Key: Char);
    begin
     if (k>='0') and (k<='9') or (k=chr(8)) or (k=chr(13))
          then
          else
            begin
              k:=chr(0);
              beep;
            end;
    end;