码迷,mamicode.com
首页 > Windows程序 > 详细

delphi 响应鼠标进入控件消息

时间:2018-11-19 14:07:58      阅读:329      评论:0      收藏:0      [点我收藏+]

标签:end   mcr   param   highlight   ble   div   and   cti   func   

procedure MSGEnter(var msg:TMessage);message CM_MOUSEENTER;//响应进入的消息
procedure MSGLeave(var msg: TMessage);message CM_MOUSELEAVE;//响应离开的消息

    procedure Button1Click(Sender: TObject);
    procedure tbStatusToolBarMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure FormCreate(Sender: TObject);
    procedure TBXItem1Click(Sender: TObject);
    procedure Button2MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    function GetEditText: string;
    procedure MSGEnter(var msg:TMessage);message CM_MOUSEENTER;//响应进入的消息
    procedure MSGLeave(var msg: TMessage);message CM_MOUSELEAVE;//响应离开的消息
    { Private declarations }
  public
    { Public declarations }
  end;


procedure TForm2.MSGEnter(var msg: TMessage);
var
  myobj : TObject;
begin
//  myobj := TObject(msg.LParam);//用LParam进行判断鼠标进入了哪个控件
//  if (myobj <> nil) and (myobj is TPanel) then
//    TPanel(myobj).Caption := ‘enter‘;
end;

procedure TForm2.MSGLeave(var msg: TMessage);
var
  myobj : TObject;
begin
    myobj := TObject(msg.LParam);
//  if (myobj <> nil) and (myobj is TPanel) then
//  begin
//    TPanel(myobj).Visible := False;
//    Button2.Tag := 0;
//  end;
    //TPanel(myobj).Caption := ‘leave‘;
end;

  

delphi 响应鼠标进入控件消息

标签:end   mcr   param   highlight   ble   div   and   cti   func   

原文地址:https://www.cnblogs.com/zhangzhifeng/p/9982703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!