Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2004, 01:05 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re sizing according to screen resolution

Hi,
I have vb program where the screens are disigned to fit screen resolution 1024 * 768. However, I need to fit these screens in to 800 * 600 as well. For this I used the following code ----
However, the font sizes and datacombos does not seems to change size.
(The form size changes accordingly, but in a messy way)
Can any one help me on this ??????

Thanks
Sam

Public Function resolution(myform As Form)
    'Decl for resolution indenpendent forms

    Dim mDblPerincr As Double
    Dim lngresX As Long, lngresY As Long
    On Error GoTo TrapErr

        lngresX = GetSystemMetrics(0)
        lngresY = GetSystemMetrics(1)
        mDblPerincr = lngresX / 1024

        FontSize = FontSize * mDblPerincr
          myform.FontSize = myform.FontSize * mDblPerincr
          myform.width = myform.width * mDblPerincr
          myform.height = myform.height * mDblPerincr
          myform.Left = myform.Left * mDblPerincr
          myform.Top = myform.Top * mDblPerincr


        For Each Control In myform



        With Control
                    .FontSize = .FontSize * mDblPerincr
                    .width = .width * mDblPerincr
                    .height = .height * mDblPerincr
                    .Left = .Left * mDblPerincr
                    .Top = .Top * mDblPerincr


                    .ButtonHeight = .ButtonHeight * mDblPerincr
                    .ButtonWidth = .ButtonWidth * mDblPerincr

        End With
        Next

    Exit Function
TrapErr:
    Resume Next
End Function
 
Old August 20th, 2004, 12:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

not all fonts support small sizes. for example, the VB default (ms sans serif) cannot go smaller than 8. ms serif goes down to 6 and smallfonts to 2,
some components height (like combo) does not go smaller then the selected font, so you have to change the height after setting the font.
as you said, it is messy...
good luck
Marco
 
Old August 22nd, 2004, 01:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The code in this address gives a suggestion to change the height of a combo:

http://www.aboutvb.de/khw/artikel/khwcomboheight.htm

But you'd still have a problem with the fontsize. The page is in German but the code is universal and complete. Try have a look.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sizing a form to fit different screen settings osemollie Pro VB 6 0 August 17th, 2006 11:09 AM
Screen Resolution ajeesh_online C# 1 June 14th, 2006 12:37 AM
screen resolution Adam H-W Classic ASP Basics 3 October 13th, 2004 09:13 PM
screen resolution miguel.ossa C# 2 October 9th, 2004 11:58 PM
screen resolution mistry_bhavin Pro VB.NET 2002/2003 0 March 13th, 2004 02:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.