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;
     

  • 相关阅读:
    scrapy 知乎用户信息爬虫
    快读模板&&快出模板
    洛谷P7078 贪吃蛇
    CSP2020-S1总结
    洛谷P1736 创意吃鱼法
    luogu P3004 [USACO10DEC]宝箱Treasure Chest
    Markdown与LaTeX
    洛谷P2197 【模板】nim游戏
    洛谷CF1360H Binary Median
    洛谷P1063 能量项链
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631252.html
Copyright © 2011-2022 走看看