Procedure

SetReminderFormBounds

Module

uReminders

Last Modified

10/8/2014 2:49:30 PM

Scope

Interfaced

Declaration

procedure SetReminderFormBounds(Frm: TForm; DefX, DefY, DefW, DefH, ALeft, ATop, AWidth, AHeight: integer);

Called-By Hierarchy


        SetReminderFormBounds
TfrmReminderTree.FormCreate┘ 

Called-By

Name Declaration Comments
TfrmReminderTree.FormCreate procedure FormCreate(Sender: TObject); -


Source

2199  procedure SetReminderFormBounds(Frm: TForm; DefX, DefY, DefW, DefH, ALeft, ATop, AWidth, AHeight: integer);
2200  var
2201    Rect: TRect;
2202    ScreenW, ScreenH: integer;
2203  
2204  begin
2205    SystemParametersInfo(SPI_GETWORKAREA, 0, @Rect, 0);
2206    ScreenW := Rect.Right - Rect.Left + 1;
2207    ScreenH := Rect.Bottom - Rect.Top + 1;
2208    if(AWidth = 0) then
2209      AWidth := DefW
2210    else
2211      DefW := AWidth;
2212    if(AHeight = 0) then
2213      AHeight := DefH
2214    else
2215      DefH := AHeight;
2216    if(DefX = 0) and (DefY = 0) then
2217    begin
2218      DefX := (ScreenW - DefW) div 2;
2219      DefY := (ScreenH - DefH) div 2;
2220    end
2221    else
2222      dec(DefY, DefH);
2223    if((ALeft <= 0) or (ATop <= 0) or
2224      ((ALeft + AWidth) > ScreenW) or
2225      ((ATop + AHeight) > ScreenH)) then
2226    begin
2227      if(DefX < 0) then
2228        DefX := 0
2229      else
2230      if((DefX + DefW) > ScreenW) then
2231        DefX := ScreenW-DefW;
2232      if(DefY < 0) then
2233        DefY := 0
2234      else
2235      if((DefY + DefH) > ScreenH) then
2236        DefY := ScreenH-DefH;
2237      Frm.SetBounds(Rect.Left + DefX, Rect.Top + DefY, DefW, DefH);
2238    end
2239    else
2240      Frm.SetBounds(Rect.Left + ALeft, Rect.Top + ATop, AWidth, AHeight);
2241  end;