form height?
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
hello,
i like to resize the form just to display the label1 text to adjust the size to display
so the default form height = 254
so we like to get the form height just high enough to display the text inside the label1
if more text in label1 to higher the form will be
the less text in label1 the smaller the form will be
i like to resize the form just to display the label1 text to adjust the size to display
so the default form height = 254
so we like to get the form height just high enough to display the text inside the label1
if more text in label1 to higher the form will be
the less text in label1 the smaller the form will be
Code: Select all
Thanks Dim w As Integer = label1.Width
Dim h As Integer = CalculateHeight()
Me.Height = h / 2 - label1.Text.Length
Private Function CalculateHeight() As Single
Dim g As Graphics = label1.CreateGraphics
Return g.MeasureString(label1.Text, label1.Font).Width
End Function
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
I'm not sure exactly what you are trying to accomplish here?
If your form only contains the label control, the form is border-less and the label is at point 0,0 on the form (top-left corner) then you should just be able to use:
If this is not what you are doing please explain a little bit more.
If your form only contains the label control, the form is border-less and the label is at point 0,0 on the form (top-left corner) then you should just be able to use:
Code: Select all
Which would make the form height the same height as the label.Me.Height = Label1.Height
If this is not what you are doing please explain a little bit more.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Hello,
Not that really what we want.
We need to resize the height and width of the form
with the text of label1
its like a messagebox it expand or shrink to display the text label1 so it show all to read easier
hope this helps ;)
Not that really what we want.
We need to resize the height and width of the form
with the text of label1
its like a messagebox it expand or shrink to display the text label1 so it show all to read easier
hope this helps ;)
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023