Mastodon
Programmierung

Align App Without Covering TaskBar

Align App Without Covering TaskBar
(Make your app full screen without covering the Taskbar)
Contributed by Nelson Williams
(I modified this a bit)

[code lang=”delphi”]procedure TForm1.FormCreate(Sender: TObject);
var
hand:hWnd;
r:tRect;
begin
//Get the handle of the Windows Taskbar.
hand := findWindow (‘Shell_TrayWnd’, nil);
//If the handle is not 0 then resume
If hand <> 0 then
//Get the rectangle of the Taskbar (the cord’s of area it covers)
begin
getWindowRect (hand, r);
//if aligned at all then do this…
If r.bottom-r.top <= 6 then SetBounds(0,0,Screen.Width,Screen.height) Else //if aligned to RIGHT the side, then do set the bounderies of the form to.. If r.left > 0 then
SetBounds(0,0,r.Left,Screen.Height)
Else
//if aligned to the LEFT side then do this…
If R.right < Screen.Width-10 {jic} then SetBounds(r.right,0,Screen.Width-r.Right,Screen.height) Else //If aligned on TOP then do this.. If R.bottom < Screen.height-10 {jic} then SetBounds(0,r.bottom,Screen.Width,Screen.height-r.bottom) Else //If aligned on BOTTOM then do this... SetBounds(0,0,Screen.Width,r.Top) End Else SetBounds(0,0,GetSystemMetrics(SM_CXFULLSCREEN),GetSystemMetrics(SM_CYFULLSCREEN)); //r.left, r.right, r.top, and r.bottom give you the bounds of the task bar //r.bottom - r.top gives you the height of the task bar //if height < = 6, then it's autohide end; //Enjoy..Nelson.[/code] [tags]Delphi, Application[/tags]

0 Kommentare zu “Align App Without Covering TaskBar

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.