Hallo,
so geht es bei mir:
Delphi-Quellcode:
private
OldPbWindowProc: TWndMethod;
procedure PbSubClassWndProc(var Message: TMessage);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.PbSubClassWndProc(var Message: TMessage);
begin
if Message.Msg= CM_MouseLeave then
begin
beep;//Demo
end;
OldPbWindowProc(Message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldPbWindowProc:= PaintBox1.WindowProc;
PaintBox1.WindowProc:= PbSubClassWndProc;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
PaintBox1.WindowProc:= OldPbWindowProc;
end;
Oder eine eigene PaintBox Komponente erstellen.