Some scaling issues

Tagged: 

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #70331
    kevin
    Participant

    Some weird scaling issues. See attached image.

    Hint size is corrected by including a custom manifest, setting DPI-aware.

    But then some other elements, but not all, are scaled that shouldn’t be scaled.

    Attachments:
    You must be logged in to view attached files.
    #70333
    kevin
    Participant

    P.S. Using sAlphahints, rather than native hints, fixes the hint size issue. So best not to use the manifest.

    #70342
    Support
    Keymaster

    Hello, Kevin!
    Which RAD Studio version do you use?

    #70347
    kevin
    Participant

    I’m using XE3.

    #70350
    Support
    Keymaster

    Thanks for the info. XE3 have not good support of scaling, so, maybe your solution is the best for this cause.

    #70352
    kevin
    Participant

    > XE3 have not good support of scaling

    Yes, however I’m loathe to spend several thousand dollars on the latest version of Delphi.

    For non-alphacontrols apps, the DPI-aware manifest option works fine for scaling. One simply sets form scaling to true, and be sure to use truetype fonts. Some manual adjustments still need to be made to listbox itemheights and grid rowheights.

    But alphacontrols works fine too, using sAlphahints rather than native hints.

    #70353
    kevin
    Participant

    Is there a way to change the background color of alphahints to white – or whatever color the system is using – rather than yellow?

    #70355
    Support
    Keymaster

    Yes, it’s possible, I will prepare an example code soon.

    #70362
    Support
    Keymaster

    Try to use this code in the TsSkinManager.OnActivate and OnAfterChange events:

    
    begin
      if sSkinManager1.SkinCommonInfo.Sections[ssHint] >= 0 then
        with sSkinManager1.gd[sSkinManager1.SkinCommonInfo.Sections[ssHint]] do begin
          BorderIndex := -1; // Do not use predefined image if exists
          BorderWidth := 1;
          BorderRadius := 2;
          Props[0].Color := clYellow;
          Props[0].BorderColor := clBlue;
          Props[0].FontColor.Color := clRed;
        end;
    end;
    

    required:
    uses sStyleSimply;

    #70363
    kevin
    Participant

    Sadly, this doesn’t work when I tried it. This is the code I used to test it:

    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, acAlphaHints, sSkinManager;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        sSkinManager1: TsSkinManager;
        sAlphaHints1: TsAlphaHints;
        procedure sSkinManager1Activate(Sender: TObject);
        procedure sSkinManager1AfterChange(Sender: TObject);
      private
        { Private declarations }
        procedure SetHintColor(HintColor : TColor);
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    uses sStyleSimply;
    
    const
      // NewHintColor = clWhite;
      NewHintColor = clGreen;
    
    procedure TForm1.SetHintColor(HintColor : TColor);
    begin
      if sSkinManager1.SkinCommonInfo.Sections[ssHint] >= 0 then
        with sSkinManager1.gd[sSkinManager1.SkinCommonInfo.Sections[ssHint]] do begin
          BorderIndex := -1; // Do not use predefined image if exists
          BorderWidth := 1;
          BorderRadius := 2;
          Props[0].Color := HintColor;
          Props[0].BorderColor := clBlue;
          Props[0].FontColor.Color := clRed;
        end;
    end;
    
    procedure TForm1.sSkinManager1Activate(Sender: TObject);
    begin
      SetHintColor(NewHintColor);
    end;
    
    procedure TForm1.sSkinManager1AfterChange(Sender: TObject);
    begin
      SetHintColor(NewHintColor);
    end;
    
    end.
    #70364
    kevin
    Participant

    Update: setting sAlphaHints1.UseSkinData to true will display the modified color, but only the first time the hint is shown. Thereafter the hint is completely transparent, with no visible text.

    #70700
    kevin
    Participant

    I ended up solving my scaling issues, which were complex.

    The problem isn’t with Alpha controls / skin manager.

    With XE3 I have to manually include a manifest file which specifies DPI-Aware. This takes care of the hint scaling.

    The other scaling issues were caused by other issues.

    For reference, in case others have issues with font size, always check that the form scaiing is set to false, and also check the forms “ParentFont” setting, and whether there are any other manual font size settings in the code.

    #70706
    Support
    Keymaster

    Hello, Kevin! Thank you for information.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.