Results 1 to 8 of 8

Thread: Scale Form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Scale Form

    Hello Forum

    I have a windows form programmed at a screen res. 1024x768.
    I would like to scale the form to fit the screen depending on the screen resolution.
    I am using scrollbars for the height if the form height is larger than the screen height.



    I can get the screen width :Screen.PrimaryScreen.Bounds.Width
    after that I can calculate the factor.
    e.g. form.width =1024
    screen.wdth=1600
    ==>factor =1.5625

    I thought i can do:
    Me.scale(factor)
    But it is not working

    How can I scale the form and all controls?

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: Scale Form

    One way is to play around with the anchorpoint property of each control. Say you want a button always in the lower right, you would set the anchor points to bottom right.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Scale Form

    Thanks for the reply, but what is wrong on this command.
    Me.scale(1.5625)
    .NET is asking for SizeF
    How does it looks like?

  4. #4
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: Scale Form

    Quote Originally Posted by MSDN
    SizeF Structure
    Stores an ordered pair of floating-point numbers, typically the width and height of a rectangle.
    MSDN

    Scale is asking for the factor for both the width and height.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Scale Form

    The system doesn't like: Me.scale(x,Y)
    Following error appears
    This method has been deprecated. Use the scale(Fsize ratio) method instead.

    What now?

  6. #6
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: Scale Form

    SizeF is a variable. You can't just put in 2 numbers, and assume the framework knows what you are doing. Wiith what you did it thinks you are trying to pass two integers, when it wants a size. The actual complaint it gave you is that the framework used to allow you to pass two integers to scale, but that is no longer used.

    To declare a size variable
    VB Code:
    1. Dim s As New Size(x,y)
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  7. #7
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: Scale Form

    Even though you'd like to do it with code, this tutorial is really good for learning to anchor/dock your form.

    http://www.imt.net/~joe/matt/program...vb7/index.html

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Scale Form

    Error

    The operation completed successfully
    WIN 32 Execption

    It seems I have to find a different way to adjust the form.


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