zoukankan      html  css  js  c++  java
  • 使用WndProc来处理消息

    TURLLabel = class(TLabel)
    procedure WndProc(var Message : TMessage); override;
    end;

    type
    TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}

    { TURLLabel }

    procedure TURLLabel.WndProc(var Message: TMessage);
    begin
      if (Message.Msg = CM_MOUSELEAVE) then
      begin
        Font.Color := clWindowText;
        Font.Style := Font.Style - [fsUnderline];
      end;
      if (Message.Msg = CM_MOUSEENTER) then
      begin
        Font.Color := clBlue;
        Font.Style := Font.Style + [fsUnderline];
      end;
      inherited WndProc(Message);
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      with TURLLabel.Create(Self) do
        begin
          Parent := Self;
          Left := 10;
          Top := 10;
          caption := 'www.tommstudio.com';
          Cursor := crHandPoint;
        end;
      end;
      
    end.

  • 相关阅读:
    js数组和数组去重的几种简单的方法
    nodejs项目的model操作mongo
    canvas画布
    bson
    神奇的东西
    sql与nosql
    mong大牛的blog
    mongo 增删改查
    Mongo配置基础
    session放数据库里解决丢失的问题
  • 原文地址:https://www.cnblogs.com/linyawen/p/1937020.html
Copyright © 2011-2022 走看看