gpt4 book ai didi

Delphi VirtualStringTree OnMouseEnter 和 OnMouseLeave

转载 作者:行者123 更新时间:2023-12-03 15:29:05 35 4
gpt4 key购买 nike

您好,请问是否有包含这 2 个鼠标事件的 VirtualStringTree 版本:

OnMouseEnterOnMouseLeave

最佳答案

如果您的字符串树尚不支持这些事件,那么添加这些事件很容易。

  TMyImprovedVirtualStringTree = class(TSomeVirtualStringTree)
private
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;

// Watch for MouseEnter and MouseLeave messages...
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
protected
// Provide MouseEnter() and MouseLeave() methods
// for descendent controls to override if needed.
procedure MouseEnter; virtual;
procedure MouseLeave; virtual;
published
// Publish the events so they show in Delphi's object inspecter.
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
end;

implementation

{ TMyImprovedVirtualStringTree }

procedure TMyImprovedVirtualStringTree.CMMouseEnter(var Message: TMessage);
begin
inherited;
MouseEnter;
end;

procedure TMyImprovedVirtualStringTree.CMMouseLeave(var Message: TMessage);
begin
inherited;
MouseLeave;
end;

procedure TMyImprovedVirtualStringTree.MouseEnter;
begin
if Assigned(FOnMouseEnter) then
FOnMouseEnter(Self);
end;

procedure TMyImprovedVirtualStringTree.MouseLeave;
begin
if Assigned(FOnMouseLeave) then
FOnMouseLeave(Self);
end;

关于Delphi VirtualStringTree OnMouseEnter 和 OnMouseLeave,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17538932/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com