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

    Screen Resoluiton

    Hi everyone,
    I am having problem with the screen resolution in VB. how can i make my project( the screen designing) to look good on every system ?


  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Screen Resoluiton

    The following is a simple code that you can use to make a form designed in 800x600 mode uniform over all resolutions.

    private Sub Form_Load()
    on error resume next
    Dim CtrlVar as Control
    Xratio = Screen.Width / (Screen.TwipsPerPixelX * 800)
    Yratio = Screen.Height / (Screen.TwipsPerPixelY * 600)
    for Each CtrlVar In FrmVar.Controls
    CtrlVar.Left = CtrlVar.Left * Xratio
    CtrlVar.Top = CtrlVar.Top * Yratio
    CtrlVar.Width = CtrlVar.Width * Xratio
    CtrlVar.Height = CtrlVar.Height * Yratio
    CtrlVar.Font.Size = CtrlVar.Font.Size * XRatio
    next CtrlVar
    End Sub





  3. #3
    Join Date
    Aug 1999
    Location
    California
    Posts
    264

    Re: Screen Resoluiton

    Actuallu i find it's not working well. The calculation for XRatio and YRatio is incorrect. Maybe we need to use other property something? like scalex?

    Thanks!

    Best Regards,

    Kevin Shen
    Best Regards,

    Kevin Shen

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