//把文字输出到屏幕
procedure TForm1.Button1Click(Sender: TObject);
var
cvs: TCanvas;
Rect: TRect;
Str: string;
begin
cvs := TCanvas.Create;
cvs.Handle := GetDC(0);
SetBkMode(cvs.Handle, TRANSPARENT);
//cvs.Font.Name := '宋体';
cvs.Font.Style := [fsBold, fsItalic];
cvs.Font.Size := 48;
Randomize;
cvs.Font.Color := Random($FFFFFF);
Rect := Screen.DesktopRect;
Str := '万一的 Delphi 博客';
cvs.TextRect(Rect, Str, [tfSingleLine, tfCenter, tfVerticalCenter]);
cvs.Free;
end;
//刷新显示
procedure TForm1.Button2Click(Sender: TObject);
begin
InvalidateRect(0, nil, False);
end;
标签:文字,输出,cvs,TObject,Str,屏幕,Font,Rect From: https://www.cnblogs.com/lucken2000/p/17405361.html