//在标题栏绘制文字
procedure TForm1.Button1Click(Sender: TObject);
var dc:hdc;
cvs:tcanvas;
begin
dc:=getwindowdc(handle);//取得窗体的句柄
cvs:=tcanvas.create; //生成画布
cvs.Handle:=dc;
cvs.textout(100,8,'my caption'); //绘制文字
releasedc(handle,dc);//释放句柄
end;