Ignore:
Timestamp:
May 8, 2019, 11:54:23 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Build under Lazarus 2.0.
  • Modified: Used .lrj files instead of .lrt files.
  • Modified: Removed TemplateGenerics package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UScaleDPI.pas

    r40 r41  
    215215  I: Integer;
    216216begin
     217  ImgList.BeginUpdate;
    217218  NewWidth := ScaleX(ImgList.Width, FromDPI.X);
    218219  NewHeight := ScaleY(ImgList.Height, FromDPI.Y);
     
    248249    Temp[i].Free;
    249250  end;
     251  ImgList.EndUpdate;
    250252end;
    251253
     
    284286  WinControl: TWinControl;
    285287  ToolBarControl: TToolBar;
    286   OldAnchors: TAnchors;
    287   OldAutoSize: Boolean;
    288 begin
     288  //OldAnchors: TAnchors;
     289  //OldAutoSize: Boolean;
     290begin
     291  //if not (Control is TCustomPage) then
     292  // Resize childs first
     293  if Control is TWinControl then begin
     294    WinControl := TWinControl(Control);
     295    if WinControl.ControlCount > 0 then begin
     296      for I := 0 to WinControl.ControlCount - 1 do begin
     297        if WinControl.Controls[I] is TControl then begin
     298          ScaleControl(WinControl.Controls[I], FromDPI);
     299        end;
     300      end;
     301    end;
     302  end;
     303
    289304  //if Control is TMemo then Exit;
    290305  //if Control is TForm then
     
    316331        MinWidth := ScaleX(MinWidth, FromDPI.X);
    317332        MinHeight := ScaleY(MinHeight, FromDPI.Y);
    318         Width := ScaleX(Width, FromDPI.X);
     333        // Workaround to bad band width auto sizing
     334        //Width := ScaleX(Width, FromDPI.X);
     335        Width := ScaleX(Control.Width + 28, FromDPI.X);
    319336        //Control.Invalidate;
    320337      end;
     338    // Workaround for bad autosizing of coolbar
     339    if AutoSize then begin
     340      AutoSize := False;
     341      Height := ScaleY(Height, FromDPI.Y);
     342      AutoSize := True;
     343    end;
    321344    EndUpdate;
    322345  end;
     
    330353  end;
    331354
    332   //if not (Control is TCustomPage) then
    333   if Control is TWinControl then begin
    334     WinControl := TWinControl(Control);
    335     if WinControl.ControlCount > 0 then begin
    336       for I := 0 to WinControl.ControlCount - 1 do begin
    337         if WinControl.Controls[I] is TControl then begin
    338           ScaleControl(WinControl.Controls[I], FromDPI);
    339         end;
    340       end;
    341     end;
    342   end;
    343355  //if Control is TForm then
    344356  //  Control.EnableAutoSizing;
Note: See TracChangeset for help on using the changeset viewer.