This example effect chart:
Code files:Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls;
Type
TForm1 = Class (Tform)
Button1:tbutton;
Button2:tbutton;
Procedure Button1Click (Sender:tobject);
Procedure Button2click (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses Gdipobj, GDIPAPI;
Procedure Tform1.button1click (Sender:tobject);
Var
G:tgpgraphics;
Sb:tgpsolidbrush;
Font:tgpfont;
Begin
G: = Tgpgraphics.create (Canvas.handle);
SB: = Tgpsolidbrush.create (Aclblack);
{Specify font name and font size to create Tgpfont class}
Font: = Tgpfont.create (' song Body ', 9);
g.DrawString (' Feminine character pingyang flower leaning on peach edge fold flowers do not see my tears streaming streams ',-1, Font, Makepoint (10.0,20), SB);
{Parameter 2 is-1 indicates that all specified characters are output; parameter 4 must be a TGPPOINTF structure}
Font. Free;
Sb. Free;
G.free;
End
Procedure Tform1.button2click (Sender:tobject);
Var
G:tgpgraphics;
Sb:tgpsolidbrush;
Font:tgpfont;
Begin
G: = Tgpgraphics.create (Canvas.handle);
SB: = Tgpsolidbrush.create (Aclblack);
{Using the features of other DCs to establish tgpfont classes; it doesn't seem to inherit all features, such as Font color}
Canvas.Font.Name: = ' song body ';
Canvas.Font.Size: = 9;
Font: = Tgpfont.create (Canvas.handle);
g.DrawString (' Children's famous birds and elder sister also shoulder double line peach tree under the back Fu who pity ',-1, Font, Makepoint (10.0,40), SB);
Font. Free;
Sb. Free;
G.free;
End
End.