处理WM_NCPaint消息
private
{ Private declarations }
procedure WMNCPAint(var Mes : TWMNCPaint); message WM_NCPAINT;
procedure TForm1.WMNCPaint(var Mes : TWMNCPaint);
var
ACanvas : TCanvas;
begin
ACanvas := TCanvas.Create;
try
ACanvas.Handle := GetWindowDC(Form1.Handle);
with ACanvas do begin
Brush.Color := clActiveCaption;
Font.Name := 'Times New Roman';
Font.Size := 10;
Font.Color := clCaptionText;
Font.Style := [fsItalic, fsBold];
TextOut(GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CXBORDER),
Round((GetSystemMetrics(SM_CYCAPTION) - Abs(Font.Height))/2) +1,
' Your title here!');
end;
finally
ReleaseDC(Form1.Handle, ACanvas.Handle);
ACanvas.Free;
end;
end;