2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs;
8
9 type
10 TForm1 = class (TForm)
11 procedure FormPaint(Sender: TObject);
12 end ;
13
14 var
15 Form1: TForm1;
16
17 implementation
18
19 { $R *.dfm }
20
21 uses GDIPOBJ, GDIPAPI;
22
23 procedure TForm1.FormPaint(Sender: TObject);
24 var
25 g: TGPGraphics;
26 p: TGPPen;
27 begin
28 g : = TGPGraphics.Create(Canvas.Handle);
29 p : = TGPPen.Create(clWebSkyBlue, 2 );
30 g.Clear(MakeColor( 255 , 255 , 255 ));
31
32 // g.SetSmoothingMode(SmoothingModeHighQuality);
33 // SmoothingModeHighQuality也可用SmoothingModeAntiAlias代替,至今不明白它们有什么区别。SmoothingModeHighQuality = 2 ,SmoothingModeAntiAlias = 4
34
35 g.DrawLine(p, 0 , 0 , 100 , 100 );
36 g.DrawLine(p, MakePoint( 0 , 10 ), MakePoint( 100 , 110 ));
37
38 g.Free;
39 p.Free;
40 end ;
41
42 end.
绘图质量参数:
SmoothingModeInvalid = -1; 指定一个无效模式
SmoothingModeDefault = 0; 指定不消除锯齿
SmoothingModeHighSpeed = 1; 指定高速度、低质量呈现
SmoothingModeHighQuality = 2; 指定高质量、低速度呈现
SmoothingModeNone = 3; 指定不消除锯齿
SmoothingModeAntiAlias = 4; 指定消除锯齿的呈现