在dephi2010下,IGPgraphics的drawstring和IGPGraphicsPath的addstring绘制给定大小的文字,出现不一致,效果见下图,相关代表如下,请问大虾们,怎么样才能让他们绘制出一致的文本。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,gdiplus;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FGraphics:IGPGraphics;
FFont:IGPFont;
pt:TGPPointF;
FGPPath:IGPGraphicsPath;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FFont:=TGPFont.Create('宋体',100);
pt.Initialize(100,100);
FGPPath:=TGPGraphicsPath.Create();
FGPPath.AddString('hello,world!',TGPFontFamily.Create('宋体'),[],100,pt,nil);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
FGraphics:=TGPGraphics.Create(Handle );
FGraphics.DrawString('hello,world!',FFont,pt,TGPSolidbrush.Create(TGPColor.Red ) );
FGraphics.FillPath(TGPSolidBrush.Create(TGPColor.Green),FGPPath );
end;
end.