unit FontUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Font : hFont;
LogFont : TLogFont;
F : TFont;
begin
FillChar(LogFont, SizeOf(LogFont), 0);
With LogFont do
Begin
lfHeight := 20;
lfOrientation := 1800;
lfEscapement := 1800;
lfWeight := FW_BOLD;
lfCharSet := RUSSIAN_CHARSET;
StrCopy(lfFaceName, 'Times New Roman');
End;
Font := CreateFontIndirect(LogFont);
F := TFont.Create;
F.Handle := Font;
Canvas.Font := F;
Canvas.Brush.Color := Color;
Canvas.TextOut(300, 100, 'Font Demo');
F. Free;
DeleteObject(Font);
end;
end.
|