マウスをその場所に移動したときに、パネルにあるすべてのものを表示するにはどうすればよいですか?
もう一度離すとフェードアウトしますか?
表示されているときにそれを行うことは問題ではありません (フェードアウトを除く)。onmouseleaves でこれを行うことができます。
しかし、それが見えないとき、どうやってそれを見えるようにするのでしょうか?
ありがとう
パネルを別の(空白の)パネルに置きます。空白のパネル上でマウスを動かすと、「マジック」パネルが表示されるようにします。
OPにWebBrowser上のパネルがあることがわかったので、編集しました。ダミー/ブランクパネルを配置するという私のソリューションは機能しなくなりました。WebBrowser に送られるマウス メッセージを妨害することも良い考えではないため、これを修正する簡単な方法を次に示します。間隔を「100」に設定してTTimerを使用しており、マウス座標をプールしています。
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;
パネルが表示される領域がある場合は、下にあるフォームまたは親パネルのマウス移動イベントをキャプチャして、非表示のパネルが表示される境界内にあることを確認できます。
例えば。(疑似コード)
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ((X > MyPanel.Left) and (Y > MyPanel.Top) and (X < mypanel.right) and
(Y < mypanel.bottom)) then
begin
mypanel.visible := true;
end;
end;