本例效果圖:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormPaint(Sender: TObject);
var
DC: HDC;
begin
Self.Color := clWhite;
Canvas.Font.Name := '宋體';
Canvas.Font.Size := 100;
Canvas.Font.Style := [fsBold, fsItalic];
Canvas.Pen.Color := clBlue;
DC := Self.Canvas.Handle;
BeginPath(DC);
SetBkMode(DC, TRANSPARENT);
Canvas.TextOut(10, 10, '博客');
EndPath(DC);
StrokePath(DC);
end;
end.