|
-
May 31st, 2004, 02:39 AM
#1
Thread Starter
Fanatic Member
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.
-
May 31st, 2004, 03:04 AM
#2
VB Code:
Me.Size=New Size(300,400)
-
May 31st, 2004, 05:38 AM
#3
Hyperactive Member
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)
-
May 31st, 2004, 12:33 PM
#4
Thread Starter
Fanatic Member
Originally posted by Edneeis
VB Code:
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!
-
May 31st, 2004, 12:59 PM
#5
New Size(300,400) is certainly short cut but resetting trivial Width/Height will also work:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Width = Me.Width * 1.5
Me.Height = Me.Height * 1.5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|