|
-
Jun 9th, 2006, 01:27 PM
#1
Thread Starter
Junior Member
Point A to point B
i am using this
VB Code:
Dim FirsttoLast As String
FirsttoLast = Mid(TextToScroll, 1, 1)
TextToScroll = TextToScroll.Remove(0, 1)
TextToScroll = TextToScroll.Insert(Microsoft.VisualBasic.Len(TextToScroll), FirsttoLast)
ScrollingText.Text = TextToScroll
but how would i scroll it with lenth to it. like from point a to point b.
Last edited by paperthinstories; Jun 9th, 2006 at 01:42 PM.
-
Jun 9th, 2006, 01:35 PM
#2
Frenzied Member
Re: need help
 Originally Posted by paperthinstories
i am using this
VB Code:
Dim FirsttoLast As String
FirsttoLast = Mid(TextToScroll, 1, 1)
TextToScroll = TextToScroll.Remove(0, 1)
TextToScroll = TextToScroll.Insert(Microsoft.VisualBasic.Len(TextToScroll), FirsttoLast)
ScrollingText.Text = TextToScroll
but how would i scroll it with lenth to it. like from point a to point b.
... no clue wat ur trying to do.
heres a few tips.
• better title
• more detail
(note: this is not a flame. just a suggestion)
-
Jun 9th, 2006, 01:41 PM
#3
Thread Starter
Junior Member
Re: need help
How would i make a group of text scroll in a label or picture box or anything of that nature sorry for all of the confustion.
Last edited by paperthinstories; Jun 10th, 2006 at 07:17 AM.
-
Jun 10th, 2006, 07:19 AM
#4
Thread Starter
Junior Member
Re: Point A to point B
hey sorry for all of the confusion about the coding uptop but all i am trying to do is just scroll text in a label.
-
Jun 10th, 2006, 09:21 AM
#5
Re: Point A to point B
So you're saying that you want a line of text to scroll form one side to the other, correct? If so you could do it by manipulating the text but it will be smoother and easier to actually move the Label. I would add a Panel to the form that was the same Height as your Label and took up the entire Width that you wanted to scroll. I would then start the Label all the way to the Right of the Panel and use a Timer to move it to the Left. Once it gets all the way to the Left you can start again, stop or go back the other way.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Start the Label at the far right of the Panel.
Me.Label1.Left = Me.Panel1.Width
Me.Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Move the Label to the left.
Me.Label1.Left -= 10
If Me.Label1.Right <= 0 Then
'Start again.
Me.Label1.Left = Me.Panel1.Width
End If
End Sub
You can adjust the Interval of the Timer and the amount you move the Label by each time to make the effect smoother and whatever speed you want.
-
Jun 10th, 2006, 09:48 AM
#6
Thread Starter
Junior Member
Re: Point A to point B
the thing with that i found out is that its not professinal looking it skips . So it i couldnt use it . SO what i did was this ..
VB Code:
Dim FirsttoLast As String
FirsttoLast = Mid(texttoscroll, 1, 1)
texttoscroll = texttoscroll.Remove(0, 1)
texttoscroll = texttoscroll.Insert(Microsoft.VisualBasic.Len(texttoscroll), FirsttoLast)
Label1.Text = texttoscroll
and what that does it it will take one letter at a time and push the other letters further down the line .what im having a problem with is geting the text to scroll the lenth of the label.
iv tried filling up the label1 with spaces but it doesnt seem to be the right way . so iv just dealt with it .
-
Jun 10th, 2006, 04:03 PM
#7
Re: Point A to point B
Here is a solution that smoothly scrolls text similar to above posts. It's in VB6 but can easily be converted.
http://www.vbforums.com/showpost.php...12&postcount=7
Another thought is to use GDI+ methods
-
Jun 10th, 2006, 09:49 PM
#8
Re: Point A to point B
You've pretty much got three choices with the text itself.
1. You can manipulate the Text property as you have been.
2. You can leave the Text property alone and manipulate the Location property as I suggested.
3. You can use GDI+ to draw the text directly on the form or another control.
The method of changing the Text itself will be the worst of all because unless you're using a fixed-width font the characters will all be different widths so you will not get an even scroll.
There is absolutely no reason that the method I suggested should "not look professional" or "skip". Did you do as I suggested and manipulate the Timer's Interval and the amount the Label was moved by? I'm guessing not becuase if you had you would have got a smoother scrolling effect. If you make the Interval and the amount you move the Label by smaller then the effect will get smoother. I just tried it with a Timer Interval of 10 and a Label increment of 1 and it was perfectly smooth. The post moeur links to essentially looks like a more complex version of what I posted earlier.
GDI+ may be the best method of all as you can simply Invalidate a small portion of the form and have the text redrawn at a new location. If you have no experience with GDI+ you'd have to learn the basics of that, although it's pretty simple.
Having said all that, you are relying on a Timer to regardless of the method you use. That means that if the UI thread is perfroming some other intensive operation the scrolling effect will suffer because it may not be able to process the Tick events exactly as they are raised. Any significant delaying in handling an event will cause a jerk in the scrolling effect. If your not doing anything else too intensive in the UI thread then you've got no issue.
-
Jun 11th, 2006, 09:07 AM
#9
Thread Starter
Junior Member
Re: Point A to point B
well, i was going to use GUI = system.drawing.text right , stuff of that nature . Iv been trying to learn how to draw text on the form but i couldnt seem to get it to work . if you have any resources for graphic help please send it my way. thanks for the help...
-
Jun 11th, 2006, 10:02 AM
#10
Frenzied Member
Re: Point A to point B
Take a look at the GDI links in my signature.
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
|