|
-
Oct 9th, 2005, 03:25 PM
#1
Thread Starter
Frenzied Member
Scalemode???
I searched the MSDN library and got so badly drowned in results, I soon gave up and searched the Visual Basic.net forum. Found no useful information...
And now my question:
I have a text box in a form that needs to be adjusted in size when the form is resized. In Visual Basic 5 (or 6) I would simply read the form's Width and Height properties and usually I would have the Scalemode property set to measure in characters for convenience. My code would normally look like this for example:
Private Sub Form_Resize()
Text1.Width = Form1.ScaleWidth - 2
Text1.Height = Form1.ScaleHeight - 2
End Sub
How can I do the same in Vb.net?
Note:
I'm beginning to think that one of Microsoft's design goals for Vb.net was to drive every programmer who tries to make the switch from Visual Basic 6 (or older versions) insane...
-
Oct 9th, 2005, 03:32 PM
#2
Fanatic Member
Re: Scalemode???
Either I'm missing something in your post, or your problem can be solved easily with anchors. Do a search on those, or experiment.
Anchoring an object to a side of the form will make it resize with the form in that direction. It's also handy, and sometimes not, because it does it in design time too, so you can resize your form and have the objects automatically keep the layout. This is also an easy way to find out any problems with your anchors.
I think it's very easy, so you should easily get the hang of them. Have a go!
Hope that helped.
Edit: I re-read your post about 5 times and I'm beginning to think that your problem may not have been covered. I hope I'm wrong as I can't help you if it hasn't.
-
Oct 9th, 2005, 03:36 PM
#3
Thread Starter
Frenzied Member
Re: Scalemode???
I thought anchoring was to help keep objects in place, not to help resize them? I'll have a look tomorrow. If any one has any other suggestions, I would like to hear them.
-
Oct 9th, 2005, 03:41 PM
#4
Re: Scalemode???
This sets the width and height of a multiline textbox on the form, resizes it on form resize event.. so its always a third of the height and width of the form...
VB Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
TextBox1.Width = Me.Width \ 3
TextBox1.Height = Me.Height \ 3
End Sub
-
Oct 11th, 2005, 10:41 AM
#5
Thread Starter
Frenzied Member
Re: Scalemode???
LITHIA,
Anchors solved my problem. They can not only be used to keep objects in place but, also to maintain their size relative to the parent object. Thanks for helping.
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
|