Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Formulartitelleiste (https://www.delphipraxis.net/11715-formulartitelleiste.html)

Stinger 12. Nov 2003 12:56


Formulartitelleiste
 
Hi,

wie kann man erkennen ob sich der Mauszeiger in der Titelleiste eines Formulars befindet?

Gruß

Stinger

sakura 12. Nov 2003 18:52

Re: Formulartitelleiste
 
Hi Stinger,

dazu musst Du die Windows-Botschaft WM_NCMOUSEMOVE abfangen

Delphi-Quellcode:
type
  TForm1 = class(TForm)
  private
    { Private declarations }
  protected
    procedure WmNcMouseMove(var Msg: TWMNCMouseMove); message WM_NCMOUSEMOVE;
  public
    { Public declarations }
  end;

...

procedure TForm1.WmNcMouseMove(var Msg: TWMNCMouseMove);
begin
  ShowMessage('Maus in Form ausserhalb des Client Bereiches');
  inherited;
end;
Damit wird allerdings auch erkannt, wenn die Mouse den Rand berührt, aber das kann man ja abgfangen...

...:cat:...

eddy 12. Nov 2003 19:59

Re: Formulartitelleiste
 
Hallo Sakura,

WmNcMouseMove springt auch schon an, wenn der Mauszeiger in das MainMenu kommt. Kann man auch noch die Koordinaten (X,Y) des Mauszeigers innerhalb von WmNcMouseMove ermitteln?

mfg
eddy

Stinger 13. Nov 2003 08:22

Re: Formulartitelleiste
 
Und wie kann ich verhindern dass Windows erkennt dass sich der Mauszeiger in der Titelleiste befindet, sprich dass es irgendeine Msg. erhält wenn der Cursor in dem Bereich ist?

s14 13. Nov 2003 08:37

Re: Formulartitelleiste
 
Da TWMNCMouseMove von TWMNCHitMessage kommt sollte

Delphi-Quellcode:
if msg.HitTest = htCaption then ...
funktionieren.

Gruß
s14

Stinger 13. Nov 2003 08:44

Re: Formulartitelleiste
 
Und wie blockier ich die jetzt? indem ich Win vorgauckle es wäre nicht in der Titelleiste sondern im Client?

EDIT: Ok, das hat funktioniert. Das Problem ist, jetzt kann ich die Bordericons nicht mehr anklicken.

s14 13. Nov 2003 08:48

Re: Formulartitelleiste
 
ich vermute mal

Delphi-Quellcode:
if msg.HitTest = htCaption then msg.HitTest := HTNOWHERE
oder

Delphi-Quellcode:
if msg.HitTest = htCaption then msg.HitTest := HTCLIENT

Stinger 13. Nov 2003 09:01

Re: Formulartitelleiste
 
Funktioniert doch nicht so, das Fenster lässt sich immer noch verschieben.

s14 13. Nov 2003 09:07

Re: Formulartitelleiste
 
Dann solltest Du die MouseDown Nachricht abfangen

Delphi-Quellcode:
procedure WMNcLButtonDown(var msg: TWMNcLButtonDown); message WM_NCLBUTTONDOWN;

procedure TForm1.WMNcLButtonDown(var msg: TWMNcLButtonDown);
begin
  if msg.HitTest = htCaption then msg.HitTest := htClient;
  inherited;
end;
Hab ich jetzt aber nicht getestet :roll:

Stinger 13. Nov 2003 09:17

Re: Formulartitelleiste
 
Funktioniert, danke :).


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:22 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz