CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    42

    Problem with Form

    hii,
    i have a form which is set to be maximized when loaded.
    but if i make it normal size or small size, there are no scroll bars to see the whole form .

    Secondly , when i have designed in 1152 by 864 pixels ,
    so when i load it in other format like 800 by 600 pixels , the form goes out of the screen, how can i resize it according to the pixel settings of different comps

    yogi

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Problem with Form

    You can set the scrollbar property of the form to show one or both scrollbars

    and in form load, you can set myform.hieght=screen.height and myform.width=screen.width
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Problem with Form

    Well, another more complicated way to determine the screen resolution settings, would be to use the GetDeviceCaps API. Here's a sample:
    Code:
    'Declarations
    Private Declare Function GetDeviceCaps Lib _
    "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long 'to get res settings
    
    Private Const HORZRES = 8 'X axis in pixels
    Private Const VERTRES = 10 'Y axis in pixels
    
    Private Sub Form_Load()
    Dim x, y
    
    x = GetDeviceCaps(Me.hdc, HORZRES) 'x
    y = GetDeviceCaps(Me.hdc, VERTRES) 'y
    
    MsgBox "Current Resolution is " & x & " X " & y & " Pixels"
    
    If x > 800 And y > 600 Or x < 800 And y < 600 Then
        MsgBox "This Program Is Designed In 600 By 800 Mode, " _
        & "Please Reset Your Resolution Settings To Get The Best Effect"
        End
     'you can do something else in here, instead of exiting the app
    End If
    
    End Sub

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Problem with Form

    Quote Originally Posted by dglienna
    ... you can set myform.height=screen.height and myform.width=screen.width
    Yes, but IMHO this will shrink your form in the right and bottom normally. So better compare the size with the size of your form and then find out how much % the sizes of each control needs to be reduced. ( If possible) The better way of construction is normally to design it in the smallest size you want to have it fully working and then expanding all positions of your control and sometimes the width
    and height, of your controls to the size which you need for higher resolutions. Then your form seems that it doesn't change even if resolution changes. Its some work but this is one of the points which makes a good program
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Problem with Form

    Or, if the app is done, or you don't want to redesign all of your forms, you can download Active Resizer from www.vbgold.com
    They have a trial version available, but the retail version is less than $30.

    It allows you to drop a control onto each form, and then auto resizes it to match any screen resolution. It works well.

    I bought it because my forms didn't look quite right at 800x600, because I designed them at 1024x768. I have about 55 forms to fix.

    Then I used it for another app that I finished. It has paid for itself twice!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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