SetWindowLong(Edit1.Handle, GWL_STYLE, GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_CENTER);
Edit1.Invalidate;

//如果右对齐,将ES_CENTER变成ES_RIGHT

//(转自http://blog.csdn.net/wudi_1982/article/details/1205472

//限制输入位数为2

Edit1.MaxLength := 2;

//只允许输入数字

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9', #3, #13, #8, #22]) then
    key := #0;
end;

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2021-10-01
  • 2021-08-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案