用DrawText函数画字时字体大小是根据什么来的?

thevagrantman 2004-12-03 07:45:19
好像跟上下文没有关系。
...全文
420 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
thevagrantman 2004-12-04
  • 打赏
  • 举报
回复
知道了。谢谢提示
thevagrantman 2004-12-04
  • 打赏
  • 举报
回复
能不能说清楚一点。不知道怎么应用CreateFontIndirect和SelectObject哦。
dext 2004-12-04
  • 打赏
  • 举报
回复
CreateFontIndirect

AND

SelectObject
Frank.WU 2004-12-04
  • 打赏
  • 举报
回复
在DRAWTEXT中各个参数说明如下://by bluebilly(蓝色天使)
Handle你写得是对的,第二个参数好象是PCHAR, 第三个是你所要输出字符的长度,第四个参数是在哪一个范围内输入上述文字,第五个参数是表示以什么样的文字排列方式进行输出,具体如下:
在我的例子中,变量h, r, txtStr为全局变量,你可以在此基础上试试:

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);

begin
caption := inttostr(x)+':'+inttostr(y);
r := Rect(x, y, x+200, y+200);
DrawText(h, pchar(TxtStr), Length(TxtStr), r, DT_LEFT);
//TextOut(h, x, y, pchar('Example'), Length(txtstr));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
h := GetDc(Handle);
txtStr := 'Example';
end;
g961681 2004-12-03
  • 打赏
  • 举报
回复
只能帮你顶!
thevagrantman 2004-12-03
  • 打赏
  • 举报
回复
没人理我。

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧