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 6151893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:50:12+00:00 2026-05-23T19:50:12+00:00

I have two forms. In a primary form I have a button wich calls

  • 0

I have two forms. In a primary form I have a button wich calls a constructor of another form. After form is loaded I need it to automaticky call a function which will move this form in some direction. I’m having a hard time to find event which will do the work because events like Load or Shown are performed before form is actualy “shown”… That means loop which is moving the form is finished sooner than the form apears and the form is shown in final position. Does anyone know event trigerred after form is visible ? or know another solution to this problem ?

On another topic I’ve read about Shown event but unfortunatly its acting same as Load event and I dont understand why 🙁 There is just one solution I keep in mind its create second thread with 500ms delay (which should be enough to load form) which will start move() metod but I dont know how to call function created on different thread 🙁 … thread would end simultaneously with move() metod.

Second form named Title:

public partial class Title : Form
{

    public Title()
    {
        InitializeComponent();
        this.Left = (Screen.AllScreens[0].Bounds.Width + Screen.AllScreens[1].Bounds.Width / 2 - this.Width / 2);
        this.Top = (Screen.AllScreens[1].Bounds.Height-80);        


    }

    // metod moves form
    public void move() 
    {

        while (this.Top > 400)
        {
            this.Top--;
            Thread.Sleep(1);
        }
    }

    // another button closes this form with reverse move animation - this works fine
    public void Destruct()  
    {
        while (this.Top < (Screen.AllScreens[1].Bounds.Height - 80))
        {
            this.Top++;
            Thread.Sleep(1);

        }
        this.Close();
    }

    private void Title_Shown(object sender, EventArgs e)
    {
        move();
    }


}

[SOLUTION]
I have used Windows.Timer instead of Thread.Sleep() in loop.

  • 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-23T19:50:13+00:00Added an answer on May 23, 2026 at 7:50 pm

    It seems you are going to create some kind of slow fly in effect.
    I would suggest you use a timer instead of loop with Thread.Sleep().
    You can create and enable timer in your event.
    After every tick of the timer you move the window a little bit.
    After it reaches the end position you just disable timer (Enabled=false).
    You can use timer control from toolbox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two forms, form A and form B. These forms must differ in
I have two forms, one with a radio button that users must select to
I have two forms. The first form is the mainForm, this never goes anywhere.
I (currently) have two forms, one that needs to call the other. In other
Lets say I have two tables, one for transactions, and another table who's primary
I have two forms in one view updating the User Profile. One Form is
I have two sections(primary and secondary) in a form with several textboxes which display
I have two forms. The first form Main has 2 buttons and a link
I have two table 1. Airline -id(primary), name 2. Form - id(primary), operator, other
I have two forms on a page (one is being grabbed by AJAX). I

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.