unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
procedure Panel1Showing;
// Ausklappen
procedure Panel1Hiding;
// Einklappen
public
{ Public-Deklarationen }
procedure CMMouseEnter(
var Message: TMessage);
message CM_MOUSEENTER;
// Mouseoverereignisse
procedure CMMouseLeave(
var Message: TMessage);
message CM_MOUSELEAVE;
// abfangen
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
DoubleBuffered := true;
// Form1
Panel1.Align := alNone;
Panel1.Tag := -Panel1.Width + 5;
Panel1.Left := Panel1.Tag;
end;
procedure TForm1.CMMouseEnter(
var Message: TMessage);
begin
if Message.LParam = Longint(Panel1)
then Panel1Showing;
end;
procedure TForm1.CMMouseLeave(
var Message: TMessage);
begin
if Message.LParam = Longint(Panel1)
then Panel1Hiding;
end;
procedure TForm1.Panel1Showing;
begin
while Panel1.Tag < 0
do
begin
Panel1.Left := Panel1.Tag;
Panel1.Tag := Panel1.Tag + 1;
sleep(1);
// oder halt Delay verwenden
application.ProcessMessages;
end;
Panel1.Align := alLeft;
end;
procedure TForm1.Panel1Hiding;
begin
windows.Beep(880,025);
Panel1.Align := alNone;
Panel1.Tag := 0;
while Panel1.Tag > -Panel1.Width + 5
do
begin
Panel1.Left := Panel1.Tag;
Panel1.Tag := Panel1.Tag - 1;
sleep(1);
// oder halt Delay verwenden
application.ProcessMessages;
end;
end;
end.