Hola pacopepin.
Afinando un poco el lápiz podría quedar así:
Código Delphi
[-]
unit uPanelHide;
interface
uses Messages, Classes, Controls, ExtCtrls;
type
TPanel = class(ExtCtrls.TPanel)
private
FInPanel: Boolean;
procedure MouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
procedure MouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
public
property InPanel: Boolean read FInPanel;
end;
implementation
procedure TPanel.MouseEnter(var Msg: TMessage);
begin
FInPanel := True;
end;
procedure TPanel.MouseLeave(var Msg: TMessage);
begin
FInPanel := False;
end;
end.
Form donde se quiere usar:
Código Delphi
[-]
unit Unit2;
interface
uses
Windows, Messages, ..., ExtCtrls, uPanelHide;
type
TForm2 = class(TForm)
Panel1: TPanel;
...
form principal:
Código Delphi
[-]
...
procedure TForm1.MouseEvent(var Msg: tagMsg; var Handled: Boolean);
begin
if ( Msg.message = WM_LBUTTONDOWN ) or ( Msg.message = WM_RBUTTONDOWN ) then
begin
if Assigned(Form2) then
with Form2.Panel1 do Visible := InPanel;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := MouseEvent;
end;
Saludos