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 SHAppBarMessage Position richtig festlegen (https://www.delphipraxis.net/192664-shappbarmessage-position-richtig-festlegen.html)

Hobbycoder 9. Mai 2017 16:30

SHAppBarMessage Position richtig festlegen
 
Hi,

irgendwas ist an meiner Procedure quer.
Zum einen habe bei ABE_TOP 2/3 des Screens als AppBar, aber meine Form wird trotzdem rechts gezeichnet.
Und die Größenangaben für meine Form wird ignoriert. Heißt, sie wird nicht 100 Pixel breit, sondern immer so um die 200.

Mache ich hier irgendwas total verkehrt? Wär nett, wenn da mal einer drüber guckt. Ich puzzle hier schon Stundenlang mit rum.

Delphi-Quellcode:
  frm_toolwindows.BorderStyle:=bsNone;
  Data.cbSize := SizeOf(TAppBarData);;
  Data.hWnd := frm_toolwindows.Handle;
  case AppBarPosition of
    abpLeft:
      begin
        Data.uEdge := ABE_LEFT;
        Data.rc.Left := 0;
        Data.rc.Top := 0;
        Data.rc.Right := 100;
        Data.rc.Bottom := GetSystemMetrics(SM_CYSCREEN);
      end;
    abpTop:
      begin
        Data.uEdge := ABE_TOP;
        Data.rc.Left := 0;
        Data.rc.Top := 0;
        Data.rc.Right := GetSystemMetrics(SM_CXSCREEN);
        Data.rc.Bottom := 100;
      end;
    abpRight:
      begin
        Data.uEdge := ABE_RIGHT;
        Data.rc.Left := GetSystemMetrics(SM_CXSCREEN)-100;
        Data.rc.Top := 0;
        Data.rc.Right := GetSystemMetrics(SM_CXSCREEN);
        Data.rc.Bottom := GetSystemMetrics(SM_CYSCREEN);
      end;
    abpBottom:
      begin
        Data.uEdge := ABE_BOTTOM;
        Data.rc.Left := 0;
        Data.rc.Top := GetSystemMetrics(SM_CYSCREEN)-100;
        Data.rc.Right := GetSystemMetrics(SM_CXSCREEN);
        Data.rc.Bottom := GetSystemMetrics(SM_CYSCREEN);
      end;
  end;

  Data.rc.Left := GetSystemMetrics(SM_CXSCREEN)-self.Width;
  Data.rc.Top := 0;
  Data.rc.Right := GetSystemMetrics(SM_CXSCREEN);
  Data.rc.Bottom := GetSystemMetrics(SM_CYSCREEN);

  result := SHAppBarMessage(ABM_NEW, Data);

  if Result = 0 then
  begin
    ShowMessage('AppBar konnte nicht registriert werden');
    exit;
  end;
  SHAppBarMessage(ABM_QUERYPOS, Data);
  SHAppBarMessage(ABM_SETPOS, Data);
  Application.ProcessMessages;
  Self.Width:=Data.rc.Right-Data.rc.Left;
  Self.Height:=Data.rc.Bottom-Data.rc.Top;
  MoveWindow(Data.hWnd, Data.rc.Left, Data.Rc.Top, Data.rc.Right-Data.rc.Left, Data.rc.Bottom-Data.rc.Top, true);
  AppBarActive:=True;

Hobbycoder 9. Mai 2017 17:32

AW: SHAppBarMessage Position richtig festlegen
 
Vergesst meine Frage. Wenn man schon was in eine Case-Anweisung packt, dann sollte man den Ursprungscode auch entfernen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:35 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