zoukankan      html  css  js  c++  java
  • Delphi中在窗体标题栏画自定义文字

    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;
     

  • 相关阅读:
    动手动脑
    原码反码补码
    考试感想
    第八周
    第七周
    第六周
    第五周
    第四周
    Hamburger Magi(hdu 3182)
    Doing Homework(hdu)1074
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631252.html
Copyright © 2011-2022 走看看