anchor.diff:  {$I KaM_Remake.inc}
   interface
   uses
  -  Classes, ComCtrls, Controls, Buttons, Dialogs, ExtCtrls, Forms, Graphics, Math, Menus, StdCtrls, SysUtils, StrUtils,
  +  Classes, ComCtrls, Controls, Buttons, Dialogs, ExtCtrls, Forms, Graphics, Math, Menus, StdCtrls, SysUtils, StrUtils, ShellAPI,
     KM_RenderControl, KM_Settings,
     {$IFDEF FPC} LResources, {$ENDIF}
     {$IFDEF MSWindows} Windows, Messages; {$ENDIF}
  
positive.code:   RenderArea.Align := alClient;
  end;
  
  
  function TFormMain.GetWindowParams: TKMWindowParamsRecord;
  var
    Wp: TWindowPlacement;
    BordersWidth, BordersHeight: SmallInt;
  begin
    Result.State := WindowState;
    case WindowState of
  
negative.code:                     Result.Top := Top;
                    end;
      wsMaximized:  begin
                      Wp.length := SizeOf(TWindowPlacement);
                      GetWindowPlacement(Handle, @Wp);
  
                      // Get current borders width/height
                      BordersWidth := Width - ClientWidth;
                      BordersHeight := Height - ClientHeight;
  
                      // rcNormalPosition do not have ClientWidth/ClientHeight
                      // so we have to calc it manually via substracting borders width/height
                      Result.Width := Wp.rcNormalPosition.Right - Wp.rcNormalPosition.Left - BordersWidth;
                      Result.Height := Wp.rcNormalPosition.Bottom - Wp.rcNormalPosition.Top - BordersHeight;
  
                      // Adjustment of window position due to TaskBar position/size
                      case FindTaskBar(Rect) of
                        ABE_LEFT: begin
                                    Result.Left := Wp.rcNormalPosition.Left + Rect.Right;
                                    Result.Top := Wp.rcNormalPosition.Top;
                                  end;
                        ABE_TOP:  begin
                                    Result.Left := Wp.rcNormalPosition.Left;
                                    Result.Top := Wp.rcNormalPosition.Top + Rect.Bottom;
                                  end
                        else      begin
                                    Result.Left := Wp.rcNormalPosition.Left;
                                    Result.Top := Wp.rcNormalPosition.Top;
                                  end;
                      end;
                    end;
    end;
  