用画刷在屏幕上写字

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

你可能感兴趣的:(用画刷在屏幕上写字)