Ignore:
Timestamp:
Oct 11, 2016, 9:49:16 AM (8 years ago)
Author:
chronos
Message:
  • Added: DPI scaling for icons and toolbars.
File:
1 edited

Legend:

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

    r3 r104  
    190190    Temp[I] := TBitmap.Create;
    191191    Temp[I].SetSize(NewWidth, NewHeight);
    192     Temp[I].TransparentColor := TempBmp.TransparentColor;
     192    Temp[I].TransparentColor := clFuchsia;// TempBmp.TransparentColor;
    193193    //Temp[I].TransparentMode := TempBmp.TransparentMode;
    194194    Temp[I].Transparent := True;
     
    247247  WinControl: TWinControl;
    248248  ToolBarControl: TToolBar;
    249   OldAnchors: TAnchors;
    250   OldAutoSize: Boolean;
    251 begin
    252   //if Control is TMemo then Exit;
    253   //if Control is TForm then
    254   //  Control.DisableAutoSizing;
    255   with Control do begin
    256     //OldAutoSize := AutoSize;
    257     //AutoSize := False;
    258     //Anchors := [];
    259     Left := ScaleX(Left, FromDPI.X);
    260     Top := ScaleY(Top, FromDPI.Y);
    261     //if not (akRight in Anchors) then
    262     Width := ScaleX(Width, FromDPI.X);
    263     //if not (akBottom in Anchors) then
    264     Height := ScaleY(Height, FromDPI.Y);
    265     {$IFDEF LCL Qt}
    266       Font.Size := 0;
    267     {$ELSE}
    268       Font.Height := ScaleY(Font.GetTextHeight('Hg'), FromDPI.Y);
    269     {$ENDIF}
    270     //Anchors := OldAnchors;
    271     //AutoSize := OldAutoSize;
    272   end;
    273 
    274 
     249begin
     250  Control.BoundsRect := ScaleRect(Control.BoundsRect, DesignDPI);
     251  Control.Font.Height := ScaleY(Control.Font.Height, DesignDPI.Y);
    275252
    276253  if Control is TToolBar then begin
Note: See TracChangeset for help on using the changeset viewer.