| Author | Message | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| Automatically start a new line in a label if....
I've been looking all over the web for how to do this, I had no luck because I'm not to sure how I needto say it.
14 years, 7 weeks ago
What I'm trying to do is simple. My program has notifications that fade-in and fade-out. When thenotification fades-in I want it to check if the label1.width > notification.width and if that is true then I want it to use vbCrLf where it crosses the width - 10. So if notification (the form) is 300 in width and the label size is 350, it will cut off the label at 290and start a new line and use the rest of the label on the next line. So far the only way I know how to do this is just increasing the form size if the label size exceeds it,but that will lead to the form getting too wide. Any suggestions? ~Thanks in advanced, Loading. This program is in Visual Basic btw.
|
| Re: Automatically start a new line in a label if....
ewww font abuse --- Beware of your thoughts, they become your words. Beware of your words, they become your actions. Beware of your actions, they become your habits. Beware of your habits, they become your character. Beware of your character, it becomes your destiny. - Unknown
|
| Re: Automatically start a new line in a label if....
The font wouldn't go away, I tried to make it just plain text but it just wouldn't go... so it's stuck like that. It was originally posted here: http://code-guiders.com/forum/viewtopic.php?f=15&t=39&sid=c1ced5be039e4b05ba7de7d7854476b4
|
| Re: Automatically start a new line in a label if....
I dont quite understand what your trying to do. If you could explain better, i might beable to help. Wait. I think i might understand. What i would do is this. Dim Equation = me.Width / (me.Text.Length * FontSize) if Equation >= 1 then 'Use string.sub to split the text at the position and place a new line end --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| Re: Automatically start a new line in a label if....
Wildsurvival posted: (6th May 2012, 07:20 pm) To better explain it; I have a different form that appears as a notification. The form name is Notification and it has a label on it that is called NotificationText.
In my program it registers a "username" that the program can call you by. Kinda like that Siri thing for phones do. Anyways, if the name is too long it the label will go off the right side of the form.
It will say "Alright, I will call you Omgitsme from now on" and "from now on" will be off of the form because the text is too long.
I want it to automatically start a new line when it reachs the limit, so it would appear as "Alright, I will call you Omgitsme from now on" (starts on a new line, like pressing the enter key) "from now on."
So to get around this problem I want it so if NotificationText.width > Notification.width then where it cuts off start on a new line.
I hope that is explained enough for you. Just ask about what you are confused about.
|
| Re: Automatically start a new line in a label if....
Are you rendering the text or are you using a label? If you are, what i posted should help. Theres no easy code to measure if the length of the text goes off. If you render it yourself, you can use a Rectangle() and itll textwrap itself. --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| Re: Automatically start a new line in a label if....
I'm using just a plain label. So there is no way to do this? :/
|
| Re: Automatically start a new line in a label if....
You can but i would suggest you remove away from .net controls for this. I would make my own class. If you need help, add me on msn and ill help you. A_choate@live.com --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| Re: Automatically start a new line in a label if....
Just sent an invite.
|
| Re: Automatically start a new line in a label if....
According to this: http://forums.codeguru.com/showthread.php?t=370571 All you have to do is set Auto Size to false and make it multi-line? Sorry I try to stay away from .net langauges most of the time :P. --- Love you too.
|
| Re: Automatically start a new line in a label if....
OH duh. Didnt think of that. Lol. I got on teamviewer with him and rendered the text in a fixed rectangle with a custom class. --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| Re: Automatically start a new line in a label if....
Thank newguy, you're a life savor. :p
|
| Re: Automatically start a new line in a label if....
vb.net - because you want to write your own programs but don't even understand the concept of wordwrapping. (lol soz first drink in a while and this is the last day I can drink for about... errr... well 7-8 months so I'm acting like an arse.. And yet it seems I know I'm acting like it but still typing. I just typed that! And I could have just not posted this rather than keep typing. And this.. Why am I still typing? Oh God! Byes!) --- http://sordie.co.uk http://twitter.com/@SordieEO
|
| Re: Automatically start a new line in a label if....
Sordie posted: (8th May 2012, 12:48 am) vb.net - because you want to write your own programs but don't even understand the concept of wordwrapping. (lol soz first drink in a while and this is the last day I can drink for about... errr... well 7-8 months so I'm acting like an arse.. And yet it seems I know I'm acting like it but still typing. I just typed that! And I could have just not posted this rather than keep typing. And this.. Why amI still typing? Oh God! Byes!) "lol soz first drink in a while and this is the last day i can drink for ...errrr well 7-8 months"
that mean a little one on the way? --- Think Outside The Box. ..............Skids in my Undies........ ...............Cut And Paste............
|
| Re: Automatically start a new line in a label if....
Sorry I'm not a pro programmer like you? I'm trying to learn without a teacher... you didn't have to be a douche about it. It's my first time I ever needed to use this feature so I was unsure how to use it, but now I know so I wont have to ask again. |
