Ignore:
Timestamp:
Aug 18, 2021, 11:50:13 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package to newer version.
  • Modified: About dialog is now part of Common package.
  • Modified: CoolTranslator is now part of Common package.
File:
1 edited

Legend:

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

    r145 r308  
    215215  I: Integer;
    216216begin
     217  ImgList.BeginUpdate;
    217218  NewWidth := ScaleX(ImgList.Width, FromDPI.X);
    218219  NewHeight := ScaleY(ImgList.Height, FromDPI.Y);
     
    226227    Temp[I] := TBitmap.Create;
    227228    Temp[I].SetSize(NewWidth, NewHeight);
    228     {$ifdef linux}
    229     Temp[I].PixelFormat := pf24bit;
    230     {$else}
    231229    Temp[I].PixelFormat := pf32bit;
    232     {$endif}
    233230    Temp[I].TransparentColor := TempBmp.TransparentColor;
    234231    //Temp[I].TransparentMode := TempBmp.TransparentMode;
     
    252249    Temp[i].Free;
    253250  end;
     251  ImgList.EndUpdate;
    254252end;
    255253
     
    288286  WinControl: TWinControl;
    289287  ToolBarControl: TToolBar;
    290   OldAnchors: TAnchors;
    291   OldAutoSize: Boolean;
    292 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
    293304  //if Control is TMemo then Exit;
    294305  //if Control is TForm then
     
    320331        MinWidth := ScaleX(MinWidth, FromDPI.X);
    321332        MinHeight := ScaleY(MinHeight, FromDPI.Y);
    322         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);
    323336        //Control.Invalidate;
    324337      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;
    325344    EndUpdate;
    326345  end;
     
    334353  end;
    335354
    336   //if not (Control is TCustomPage) then
    337   if Control is TWinControl then begin
    338     WinControl := TWinControl(Control);
    339     if WinControl.ControlCount > 0 then begin
    340       for I := 0 to WinControl.ControlCount - 1 do begin
    341         if WinControl.Controls[I] is TControl then begin
    342           ScaleControl(WinControl.Controls[I], FromDPI);
    343         end;
    344       end;
    345     end;
    346   end;
    347355  //if Control is TForm then
    348356  //  Control.EnableAutoSizing;
Note: See TracChangeset for help on using the changeset viewer.