Author: Tomas Rutkauskas
How can I temporally turn off the Windows font anti-aliasing and turn it on after
drawing?
Answer:
1 unit Unit1;
2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
7
8 type
9 TForm1 = class(TForm)
10 procedure FormCreate(Sender: TObject);
11 procedure FormDestroy(Sender: TObject);
12 private
13 SmoothFonts: Boolean;
14 public
15 end;
16
17 var
18 Form1: TForm1;
19
20 implementation
21
22 {$R *.DFM}
23
24 procedure TForm1.FormCreate(Sender: TObject);
25 begin
26 SystemParametersInfo(SPI_GETFONTSMOOTHING, 1, @SmoothFonts, 0);
27 if SmoothFonts then
28 SystemParametersInfo(SPI_SETFONTSMOOTHING, 0, nil, SPIF_UPDATEINIFILE);
29 end;
30
31 procedure TForm1.FormDestroy(Sender: TObject);
32 begin
33 if SmoothFonts then
34 SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, nil, SPIF_UPDATEINIFILE);
35 end;
36
37 end.
Under Win95 it has only an effect if the Plus! Pack is installed (NT4 by default).
|