Manipulating a control's location property.
Hey,
This one has me stumped. I'm trying to change the location of an object's X position so that it has a marquee like effect. I'm doing this with buttons and text, etc...
I've been experimenting with code:
Code:
PictureBox1.Location = New Point(PictureBox.Location.X - 10, PictureBox.Location.Y)
With the intention of it moving 10px to the left. I would then use a timer, but it scrolls automatically for me, why?
If I try,
Code:
PictureBox1.Location = New Point(51,50)
where the Picture is previously at 50,50 it will not do this. Why?
Finally, what I want to know is:
If I use:
Code:
PictureBox1.Location = New Point(PictureBox.Location.X - 10, PictureBox.Location.Y)
which seems great (different - affects the speed). How do I get it to return on the other side of the screen?
Thanks
Re: Manipulating a control's location property.
If your using a timer for the first code then yes it would continue scrolling because you reference the controls Current X location, which changes each time.
As for your second question, I don't think you can get it to return on the otherside just like a marquee does where it splits perfectly. But you can check the pictureboxes location and once it reaches 0 - the width of your picturebox, you can reset the X location to Me.Width - PictureBox.Width
Re: Manipulating a control's location property.
It should not cause a scrolling effect as the timer effect is 60 secs however I know what to do now.
I will place return the objects to the end when they reach it and continue the behaviour
Thanks