Results 1 to 3 of 3

Thread: Manipulating a control's location property.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    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
    If you found any of my posts helpful then please rate them.

    CodeBank

    Form Fading Effects in VB.NET and C#

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    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
    If you found any of my posts helpful then please rate them.

    CodeBank

    Form Fading Effects in VB.NET and C#

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width