用画刷在屏幕上写字

procedure TForm1.btn1Click(Sender: TObject);
var
  c:TCanvas;
begin
  c:= TCanvas.Create;
  c.Pen.Width  := 5;
  c.Font.Size := 20;
  c.Font.Name := '微软雅黑';
  c.Font.Color := clRed;
  c.Brush.Color := clBlack;
  try
    //c.Handle := GetDC(0);
    c.Handle := GetWindowDC(1181728); // 这句是在一个指定窗体上写字
    c.TextOut(20,20,'曲终的BLOG');
  finally
    c.Free;
  end;
end;

转载于:https://www.cnblogs.com/rogee/archive/2010/09/14/1827253.html

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页