gpt4 book ai didi

Delphi:检测窗口移动的开始和结束

转载 作者:行者123 更新时间:2023-12-03 14:46:21 36 4
gpt4 key购买 nike

我正在使用 OnIdle 事件来实现一些简单的动画,并且它工作得很好。但问题是,当用户开始移动或调整窗口大小时,OnIdle 事件将停止触发,直到移动/调整大小操作完成。

我需要检测何时发生这种情况,以便我可以暂停所有动画。但如何检测窗口的移动呢?

最佳答案

我会同意mghie评论:为动画使用计时器,并使用消息处理程序激活/停用它。

根据您的情况,您可能需要添加以下消息处理程序:

//fired when starting/ending a "move" or "size" window
procedure WMEnterSizeMove(var Message: TMessage) ; message WM_ENTERSIZEMOVE;
procedure WMExitSizeMove(var Message: TMessage) ; message WM_EXITSIZEMOVE;


procedure TForm.WMEnterSizeMove(var msg: TMessage);
begin
AnimationTimer.Enabled := false;
inherited;
end;

procedure TForm.WMExitSizeMove(var msg: TMessage);
begin
AnimationTimer.Enabled := true;
inherited;
end;

关于Delphi:检测窗口移动的开始和结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/826863/

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