首页 新闻 会员 周边 捐助

关于gdiplus drawstring和addstring绘制差异的问题

0
悬赏园豆:10 [已关闭问题]

在dephi2010下,IGPgraphics的drawstring和IGPGraphicsPath的addstring绘制给定大小的文字,出现不一致,效果见下图,相关代表如下,请问大虾们,怎么样才能让他们绘制出一致的文本。

drawstring与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.

parkes的主页 parkes | 初学一级 | 园豆:190
提问于:2010-07-09 21:17
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册