Thema: Delphi TButton align to left

Einzelnen Beitrag anzeigen

marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#4

Re: TButton align to left

  Alt 17. Jan 2007, 16:39
Hi Lukas,

Zitat von DGL-luke:
... On the other Hand, you should be able to tell the WinAPI to align the text... but I don't know how.
it is a matter of style:

Delphi-Quellcode:
procedure TDemoForm.ButtonClick(Sender: TObject);
var
  dwStyle: LongWord;
begin
  with Sender as TButton do
  begin
    dwStyle := GetWindowLong(Handle, GWL_STYLE);
    dwStyle := dwStyle and not BS_CENTER or BS_LEFT;
    SetWindowLong(Handle, GWL_STYLE, dwStyle);
    Invalidate;
  end;
end;
Regards
  Mit Zitat antworten Zitat