Ver Mensaje Individual
  #2  
Antiguo 09-02-2012
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
Hola elGuerrero.

Creo que podrías hacer algo así:
Código Delphi [-]
...
type
  TMiEdit = class(TEdit)
  private
    FAutoWidth: Boolean;
    procedure SetAutoWidth(const Value: Boolean);
    ...
  public
    property AutoWidth: Boolean read FAutoWidth write SetAutoWidth default True;
    ...
  end;

implementation

...

procedure TMiEdit.SetAutoWidth(const Value: Boolean);
var
  B: TBitMap;
begin
  if (FAutoWidth <> Value) and (MaxLength <> 0) then
  begin
    B:= TBitMap.Create;
    try
      FAutoWidth:= Value;
      B.Canvas.Font.Assign(Font);
      Width:= B.Canvas.TextWidth(' '+Text+' ')
    finally
      B.Free
    end;
  end;
end;
...

Saludos.
__________________
Daniel Didriksen

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