zoukankan      html  css  js  c++  java
  • Inno Setup界面拉伸

    1、源起:

    源于一个安装包的广告定制。广告客服提供的图片太大,inno setup默认尺寸容不下它,需要扩充,拉宽安装界面尺寸。

    以inno setup所附带例子说事,其默认尺寸如下:

    2、ScaleX

    核心函数为ScaleX,其原型如下:

    function ScaleX(X: Integer): Integer;

    作用为适应DPI,给指定的X值在X方向上做缩放。同理有ScaleY,本例用不到。

    3、实现代码

    Inno Setup中,写自定义函数,横向缩放窗体及其所属控件,并分类调整控件位置及宽度,完成界面缩放。

    [Code]
    
    //横向拉伸长度const EXPAND_VALUE = 128; //遍历控件改其宽度 procedure ExpandPageControl(AControl: TWinControl); var i: Integer; ctrl: TControl; wc: TWinControl; begin for i := 0 to AControl.ControlCount - 1 do begin ctrl := AControl.Controls[i]; if (ctrl is TBitmapImage) and (ctrl <> WizardForm.WizardSmallBitmapImage) then Continue; if (ctrl is TButton) or (ctrl is TBitmapImage)then ctrl.Left := ctrl.Left + ScaleX(EXPAND_VALUE) else ctrl.Width := ctrl.Width + ScaleX(EXPAND_VALUE); if ctrl is TWinControl then begin wc := ctrl as TWinControl; if wc.ControlCount <> 0 then ExpandPageControl(wc); end; end; end; procedure InitializeWizard(); begin with WizardForm do begin Width := Width + ScaleX(EXPAND_VALUE); end; ExpandPageControl(WizardForm); end;

    如此就基于WizardForm对安装窗体做X轴上缩放。

    4、效果

    如图示:

  • 相关阅读:
    1063. Set Similarity
    A1047. Student List for Course
    A1039. Course List for Student
    最大公约数、素数、分数运算、超长整数计算总结
    A1024. Palindromic Number
    A1023. Have Fun with Numbers
    A1059. Prime Factors
    A1096. Consecutive Factors
    A1078. Hashing
    A1015. Reversible Primes
  • 原文地址:https://www.cnblogs.com/crwy/p/8298757.html
Copyright © 2011-2022 走看看