Einzelnen Beitrag anzeigen

papajong

Registriert seit: 16. Jun 2006
3 Beiträge
 
RAD-Studio 2010 Pro
 
#9

AW: TStaticText.Transparent funktioniert nicht?

  Alt 12. Feb 2016, 14:57
Nur für den Fall, das sich nochmal jemand hierhin verirrt, transparent funktioniert nur,
wenn man das darunterliegende Control zum Parent des TStaticText macht.
PS. Funktioniert auch bei TLabel

unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls;

type

TForm1 = class(TForm)
Timer1: TTimer;
ProgressBar1: TProgressBar;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FStaticText1: TStaticText;
public
{ Public-Deklarationen }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin

FStaticText1 := TStaticText.Create(Self);

with FStaticText1 do
begin
Name := 'StaticText1';
Parent := ProgressBar1;
Left := ProgressBar1.Width div 2;
Top := 1;
Width := 59;
Height := 17;
ParentCustomHint := False;
BiDiMode := bdLeftToRight;
Caption := '';
Color := clBtnFace;
ParentBiDiMode := False;
ParentColor := False;
TabOrder := 1;
Transparent := true;
end;

end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
ProgressBar1.StepIt;
FStaticText1.Caption := IntToStr(ProgressBar1.Position);
end;

end.

Geändert von papajong (12. Feb 2016 um 15:15 Uhr) Grund: Ergänzung
  Mit Zitat antworten Zitat