- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 通过api强制TEdit仅接受数字输入
procedure SetEditNumeric(Handle: THandle);
begin
SetWindowLong(Handle, GWL_STYLE,
GetWindowLong(Handle, GWL_STYLE) or ES_NUMBER);
end;
//点击按钮后,edit1 只能输入数字
procedure TForm2.Button1Click(Sender: TObject);
begin
SetEditNumeric(edit1.Handle);
end;