Zitat:
ahh mist ich habe jetzt auch nicht die Taskleiste beachtet, die musst du natürlich hier noch beachten:
Code:
if ((Form1.Top + Form1.Height) > (Screen.Height {- taskleistenhöhe...})) then
form1.Top := Screen.Height - Form1.Height;
Wie ermittele ich denn die Taskleistenhöhe?
Edit: Problem gelöst!
Funktion:
Delphi-Quellcode:
function GetTaskbarHeight: integer;
var
SysTray: Windows.HWND;
Rect: TRect;
begin
Result := -1;
SysTray := FindWindow('Shell_TrayWnd', nil);
If SysTray <> INVALID_HANDLE_VALUE then begin
If GetWindowRect(SysTray, Rect) then begin
Result := Screen.Height - Rect.Top;
end;
end;
end;
Restliches:
Delphi-Quellcode:
hoehe := screen.Monitors[0].Height;
breite := screen.Monitors[0].Width;
Form3.Top := hoehe-50-StrToInt(Label17.Caption); // Form3 ist 50 pixel hoch
Form3.Left := breite-272; // und 272 pixel breit
Form3.Show;