Results 1 to 5 of 5

Thread: Change Form size [RESOLVED

  1. #1

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    Change Form size [RESOLVED

    Hi,

    I was really surprised that such an easy problem as this was not covered in the forums. I looked, but couldn't find anything.

    Now, I want to change the form size at runtime, when the user clicks a label the form size gets changed.

    I have this code...

    Me.Size.Width = 298

    And i dunno wats wrong with that but i get this error:

    Expression is a value and therefore cannot be the target of an assignment.

    And with this...

    Me.Size.Width(298)

    I get

    Property access must assign to the property or use its value.

    So really, how the hell do you change it? I have no idea, surley that should work, I don't understand.

    Thanks for the help, please keep this simple.
    Last edited by LITHIA; May 31st, 2004 at 12:33 PM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. Me.Size=New Size(300,400)

  3. #3
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    I'm using memory (and I'm not too young..... ), so it's possible I fail, but I think that a code like Me.scale(2) or something similar, should be useful (If I well remember, it works also for the control contained in the form). I tried to change size of form and controls, to adapt them at a different resolution (800x600, 1024x768, ecc...), but I had some problems with text's font: the size is not auto-adapted and it's very difficult to obtain a font size with the same effect of the original, especially if you want to completely fill a textbox with a specified number of chars. I stopped my efforts in that directions, because, at that moment it was not very important to solve the problem (I tried a half a hour, about). Anyway I'm interested on changing form size, exactly as you lithya. If someone has solved problem....
    Live long and prosper (Mr. Spock)

  4. #4

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    Originally posted by Edneeis
    VB Code:
    1. Me.Size=New Size(300,400)
    thanks! knew it would be something simple like that.

    sort of works okay, but i noticed its not very acurate in relation to changing it at design time. i had to put on about 6 extra pixels to get it set back to the original size.

    strange maybe it has something to do with the grid locking, although i would have thought it would have been acurate considering...

    n/m, it works fine! thanks Edneeis!

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    New Size(300,400) is certainly short cut but resetting trivial Width/Height will also work:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Me.Width = Me.Width * 1.5
    3.         Me.Height = Me.Height * 1.5
    4.     End Sub

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