Title: How to draw transparent text on desktop
public
{ Public-Deklarationen }
procedure WriteText(TransText: string);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WriteText(TransText: string);
var
MyHand: HWND;
MyDc: HDC;
MyCanvas: TCanvas;
begin
MyHand := GetDesktopWindow;
MyDc := GetWindowDC(MyHand);
MyCanvas := TCanvas.Create;
MyCanvas.Handle := MyDC;
BeginPath(MyCanvas.Handle);
MyCanvas.Font.Color := clRed;
MyCanvas.Font.Name := 'Courier New';
MyCanvas.Font.Size := 60;
SetBkMode(MyCanvas.Handle, TRANSPARENT);
EndPath(MyCanvas.Handle);
MyCanvas.TextOut(0, 0, TransText);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
WriteText('SwissDelphiCenter');
end;