CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2001
    Posts
    4

    UI for different Screen Resolutions

    Is there any way that my mdi application remains the same(controls positioning and size ratios) in different screen resolutions.



  2. #2
    Join Date
    Oct 2000
    Location
    JHB South Africa
    Posts
    27

    Re: UI for different Screen Resolutions

    Hi.

    There are ActiveX's that will do it for you.
    Search for 'axs_resizer'

    The other method is to:
    1) find the new x & y factor (New size / Old size)
    2) loop through all the controls on the form and then multiply the top and or height with the y factor and the left and the width with x factor.
    You should decide if you are going to multiply the fontsize with the y the factor as well.

    Certain controls (ie: menu) do not allow these maniplations, so be sure to add the line :
    On Error Resume Next
    to the code before you loop through the controls to set their new values.





  3. #3
    Join Date
    Mar 2001
    Posts
    4

    Re: UI for different Screen Resolutions

    hi.
    Thanks for the help.
    But i can't consider to adjusting forms and controls at run-time since the app has around 30 forms with different types of controls one global function in bas module might be difficult.
    Can you please tell me where to find axs_resizer.

    bye



  4. #4
    Join Date
    Oct 2000
    Location
    JHB South Africa
    Posts
    27

    Re: UI for different Screen Resolutions

    It is much easier than you think
    All you have to do is:
    1)Pass the form as a form (Me ---> ME as form)
    2)I would have declared the Factor variables as Public
    3)Use the sysinfo1 control(only once on the MDI) and on change, you recalculate the factors
    2)The code does not look for type of controls, you loop through ALL of them. If it can apply the changes, it will, if it doesn't, it will move on to the next)

    Here is what you do
    ------------------------------------------------

    Private Sub Resize_Form (frm as Form)
    On Error Resume Next
    Dim Ctrl as Control

    For Each Ctrl In frm
    Ctrl.Height = Ctrl.Height * NewScaleY
    Ctrl.Top = Ctrl.Top * NewScaleY
    Ctrl.Left = Ctrl.Left * NewScaleX
    Ctrl.Width = Ctrl.Width * NewScaleX
    Ctrl.FontSize = CInt(Ctrl.FontSize * NewScaleX)
    Next
    End Sub
    -------------------------------------------------

    Here us the link to the OCX
    ***** http://axsoft.hypermart.net




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured