zoukankan      html  css  js  c++  java
  • 鼠标进入与离开的消息(使用CM_MOUSEENTER来判断是否进入控件)

    unit Unit1;

    interface

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

    type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        Edit1: TEdit;
      private
        { Private declarations }
        procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
        procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;

      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.CMMouseEnter(var Msg: TMessage);
    var
      anObject :        TObject;
    begin
      anObject := TObject(Msg.lParam);
      //进入控件
      if anObject <> nil then
      begin
        Label1.Caption := 'Mouse Enter...'; //显示信息
      end;
    end;
    procedure TForm1.CMMouseLeave(var Msg: TMessage);
    //退出控件
    var
      anObject :        TObject;
    begin
      anObject := TObject(Msg.lParam);
      if anObject <> nil then
      begin
           Label1.Caption := 'Mouse Leave...'; //显示信息
      end;
    end;


    end.

    http://blog.csdn.net/diligentcatrich/article/details/7010488

  • 相关阅读:
    线程的用法
    提高VS2010的性能,VS2010不再卡
    win7 远程桌面最大化快捷键
    java类加载器
    Class类
    JDBC获得oracle数据库主键值
    Zookeeper入门基础知识
    项目js总结
    jdk8 stream项目使用
    全局请求参数去除空格
  • 原文地址:https://www.cnblogs.com/findumars/p/5218020.html
Copyright © 2011-2022 走看看