导航

心动吧DELPHI网络书

自发研究:须要多维思想而且要想不可能为可能的人才能做到

« 在Delphi中动态生成的控件怎么响应消息一个跨越多个Service的调用的SOAP消息示例 »

用wndproc来处理消息

代码如下:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type

  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.delphi3000.com';
    Cursor := crHandPoint;
  end;
end;

end.
 

原创文章如转载,请注明:转载自心动吧DELPHI网络书 [ http://www.abcxd.com/delphi/ ]

本文链接地址:http://www.abcxd.com/delphi/abcxddelphi/delphiRENSHE/89.html

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热文排行使用

本年排行使用

本月排行使用

网站分类

搜索内容

最新评论及回复

最近发表

所属分类下的文章

日历

Copyright ⊙ 2004-2009 心动吧 UrL:ABCXD.CoM All RiGhts Reserved