Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 838493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:18:50+00:00 2026-05-15T05:18:50+00:00

I need help making this loop to move a label move smoothly across the

  • 0

I need help making this loop to move a label move smoothly across the screen using count for the animation (its required). The labels location is currently in location 0,0 I’d like to make it go in a square right -> down -> left -> back to its original position
how can I accomplish this ? please give me an example using my code below. Thank You in advance.

    private void xAnimeTimer_Tick(object sender, EventArgs e)
    {
        int count;
        this.xAnimTimer.Stop();
        for (count = 0; count <= 100; count++)
        {
            this.xAnimLabel.Left = count;
        }

        for (count = 0; count <= 150; count++)
        {
            this.xAnimLabel.Top = count;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:18:51+00:00Added an answer on May 15, 2026 at 5:18 am

    I’m not sure why you have to use a for loop (which I believe is your problem [since it appears that each tick we loop completely first; hence why it doesn’t draw ‘cleanly’]) but here’s a stab at it before I’ve had my coffee this afternoon. Note that this probably doesn’t satisfy what you want since you stated you needed a loop. Read the comments for the controls I’m using.

     public partial class Form1 : Form
    {
        int left;
        int top;
        bool flgAllTheWayToTheRight = false;
        bool flgAllTheWayToTheBottom = false;
    
        public Form1()
        {
            // on my form I have two timers, named timer1 and tmrDraw
            // and then I have label1
            InitializeComponent();
        }
    
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (left <= 100)
            { left++; }
            else
            { flgAllTheWayToTheRight = true; }
    
            if (flgAllTheWayToTheRight)
            {
                if (top <= 150)
                { top++; }
                else
                { flgAllTheWayToTheBottom = true; }
            }
    
            if (flgAllTheWayToTheBottom && flgAllTheWayToTheRight)
            {
                left = 0;
                top = 0;
                flgAllTheWayToTheRight = false;
                flgAllTheWayToTheBottom = false;
            }
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Text = "Animate Me.";
            timer1.Interval = 10;
            tmrDraw.Interval = 10;
            timer1.Start();
            tmrDraw.Start();
        }
    
        private void tmrDraw_Tick(object sender, EventArgs e)
        {
            label1.Left = left;
            label1.Top = top;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need help writing a script downloads data from google insight using c# this is
I need help with making this bit of code faster: UnitBase* Formation::operator[](ushort offset) {
This is for a tic tac toe game. I need help making a check
I need help making this code work better. Currently, what happens is when it
I need help making AOP work. What am I missing here? <?xml version=1.0 encoding=UTF-8?>
I need help with making an image float onto the canvas in HTML5 and
I need help with a program I'm making. It's a version of Conway's Game
I need help making a search query for comments (it's for a WordPress site).
I am making simple vertical loop animation with jQuery and I am stuck in
I'm making my first game using Java on Android. I need to draw a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.