gpt4 book ai didi

delphi - 当鼠标移到面板上时如何显示面板?德尔菲

转载 作者:行者123 更新时间:2023-12-03 18:24:51 25 4
gpt4 key购买 nike

当我将鼠标移到面板上的位置时,如何显示面板上的所有内容?

当我再次将其移开时,它会淡出吗?

在可见时执行此操作不是问题(淡出除外),我可以使用onmouseleaves进行此操作。

但是当它不可见时,如何使它可见?

谢谢

最佳答案

将面板放在另一个(空白)面板上。当鼠标在空白面板上移动时,使“魔术”面板出现。



编辑,因为我现在了解到OP在WebBrowser上具有面板。我放置虚拟/空白面板的解决方案不再起作用;干扰发送到WebBrowser的鼠标消息也不是一个好主意,因此,这是解决此问题的简单方法。我正在使用TTimer,其间隔设置为“ 100”,并且正在合并鼠标坐标。

procedure TForm25.Timer1Timer(Sender: TObject);
var PR: TRect; // Panel Rect (in screen coordinates)
CP: TPoint; // Cursor Position (always in screen coordinates)
begin
// Get the panel's coordinates and convert them to Screen coordinates.
PR.TopLeft := Panel1.ClientToScreen(Panel1.ClientRect.TopLeft);
PR.BottomRight := Panel1.ClientToScreen(Panel1.ClientRect.BottomRight);
// Get the mouse cursor position
CP := Mouse.CursorPos;
// Is the cursor over the panel?
if (CP.X >= PR.Left) and (CP.X <= PR.Right) and (CP.Y >= PR.Top) and (CP.Y <= PR.Bottom) then
begin
// Panel should be made visible
Panel1.Visible := True;
end
else
begin
// Panel should be hidden
Panel1.Visible := False;
end;
end;

关于delphi - 当鼠标移到面板上时如何显示面板?德尔菲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5337392/

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