TFontQuality (Delphi)
Description
The following example demostrates the use of Vcl.Graphics.TFont.Quality. The sample uses a memo, three buttons for font (a TFontDialog component is also needed on the form) and font size changing, and seven buttons, one for each font quality. Optional, for better visibility of the button the sample uses two TGroupBox components to separate the font quality buttons from the font and font size buttons.
Code
unit Font_Quality;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
FontDialog1: TFontDialog;
Button9: TButton;
Button10: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//buttons for changing the font quality
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Font.Quality := fqDefault;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Memo1.Font.Quality := fqDraft;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Memo1.Font.Quality := fqProof;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Memo1.Font.Quality := fqNonAntialiased;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Memo1.Font.Quality := fqAntialiased;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Memo1.Font.Quality := fqClearType;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Memo1.Font.Quality := fqClearTypeNatural;
end;
//opens a font dialog and let the user set the font
procedure TForm1.Button8Click(Sender: TObject);
begin
if FontDialog1.Execute then
Memo1.Font.Assign(FontDialog1.Font);
end;
//buttons for font size changing (some of the fonts do not support font size changing)
procedure TForm1.Button9Click(Sender: TObject);
begin
Memo1.Font.Size := Memo1.Font.Size + 1;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
Memo1.Font.Size := Memo1.Font.Size - 1;
end;
// puting a text in the memo from the begining
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Text := 'This is a memo';
end;
end.
Uses
- Vcl.Graphics.TFont.Quality ( fr | de | ja )
- Vcl.Graphics.TFontQuality ( fr | de | ja )