核心提示:600) this.width = 600;'>type TCustomCaptionForm = class(TForm) private procedure WMNCPaint(var Msg:...
600) this.width = 600;">
type
TCustomCaptionForm = class(TForm)
private
procedure WMNCPaint(var Msg: TWMNCPaint) ; message WM_NCPAINT;
procedure WMNCACTIVATE(var Msg: TWMNCActivate) ; message WM_NCACTIVATE;
procedure DrawCaptionText() ;
end;
...
implementation
procedure TCustomCaptionForm .DrawCaptionText;
const
captionText = 'delphi.about.com';
var
canvas: TCanvas;
begin
canvas := TCanvas.Create;
try
canvas.Handle := GetWindowDC(Self.Handle) ;
with canvas do
begin
Brush.Style := bsClear;
Font.Color := clMaroon;
TextOut(Self.Width - 110, 6, captionText) ;
end;
finally
ReleaseDC(Self.Handle, canvas.Handle) ;
canvas.Free;
end;
end;
procedure TCustomCaptionForm.WMNCACTIVATE(var Msg: TWMNCActivate) ;
begin
inherited;
DrawCaptionText;
end;
procedure TCustomCaptionForm.WMNCPaint(var Msg: TWMNCPaint) ;
begin
inherited;
DrawCaptionText;
end;