Search code examples
vb6

How can I resize my vb6 program so that it automatically fits in any screen resolution?


How can I have a vb6 program which opens correctly in 1280*1024 but when switched to other resolutions say 640*480 i can only see half of the screen. how to re-size my vb6 program so that it automatically fits in any screen resolution?


Solution

  • You need to use the Screen object, this will always give you the current resolution in pixels:

    Dim screenwidth,screenheight As Single
    
    screenwidth = Screen.Width \ Screen.TwipsPerPixelX
    screenheight = Screen.Height \ Screen.TwipsPerPixelY