welcome
using a combination of Embarcadero Delphi XE2 + FireMonkey HD App I need to implement the following:
The form, which "sticks" to the edges of the screen similar to the effect of the magnet. When approaching the form to the edge of the screen to 20 or less points - the form is drawn to the edge of the screen.
If the form is drawn to the top or bottom of the screen - the height of the form does not change the width of the form takes 100% of the width of the screen;
If the form is drawn to the left or right of the screen - width of the form remains the same, the height of the form 100% of the screen height.
Thanks for the help
{code}
procedure TMainForm.Timer1Timer(Sender: TObject);
var
newPos : TRectF;
StickAt:integer;
begin
StickAt := 20;
Size := Platform.GetScreenSize;
WorkScreenWidth := round(Size.X);
WorkScreenHeight := round(Size.Y);
newPos := platform.GetWindowRect(MainForm);
if (newPos.Location.X > StickAt) and (newPos.Location.Y > StickAt) and (Docked=true) then
begin
Timer1.Enabled:=false;
Docked:=false;
MainForm.Width:=800;
MainForm.Height:=300;
MainForm.Timer1.Enabled:=true;
end;
if (newPos.Location.X <= StickAt) and (Docked=false) then
begin
Timer1.Enabled:=false;
if not Docked then
begin
Docked:=true;
MainForm.Top:=0;
MainForm.Left:=0;
MainForm.Width:=800;
MainForm.Height:=WorkScreenHeight;
Timer1.Enabled:=true;
end;
end;
if (newPos.Location.Y <= StickAt) and (Docked=false) then
begin
Timer1.Enabled:=false;
if not Docked then
begin
Docked:=true;
MainForm.Top:=0;
MainForm.Left:=0;
MainForm.Height:=300;
Width:=WorkScreenWidth;
Timer1.Enabled:=true;
end;
end;
end;
{code}
Edited by: Anvar Mamadzanov on Sep 28, 2012 5:45 AM