Ver Mensaje Individual
  #1  
Antiguo 10-09-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Usando SetWindowLong / GetWindowLong

Hola amigos

Para quienes pueda servirle o desconozcan su uso, aquí les dejo algunas de las muchas utilidades que podemos darle a la función SetWindowLong.

Código Delphi [-]
(* Admitir sólo números *)
procedure OnlyNumber(Sender: TWinControl);
begin
  SetWindowLong(Sender.Handle, GWL_STYLE,
    GetWindowLong(Sender.Handle, GWL_STYLE) + ES_NUMBER);
end;

(* Centrar texto *)
procedure CenterJustifyText(Sender: TWinControl);
begin
  SetWindowlong(Sender.Handle, GWL_STYLE,
    GetWindowlong(Sender.Handle, GWL_STYLE) + ES_CENTER);
end;

(* Alinear a la derecha *)
procedure RightJustifyText(Sender: TWinControl);
begin
  SetWindowLong(Sender.Handle, GWL_STYLE,
    GetWindowLong(Sender.Handle, GWL_STYLE) + ES_RIGHT);
end;

Ejemplos de uso:
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  ...
  OnlyNumber(Edit1);
  CenterJustifyText(Memo1);
  RightJustifyText(DBEdit1);
  ...
end;

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita