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

  • Home
  • SEARCH
  • 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 7919207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:47:19+00:00 2026-06-03T15:47:19+00:00

I am writing an MDI application in C# that contains two child forms which

  • 0

I am writing an MDI application in C# that contains two child forms which are referenced through DLL (stand alone projects added to references).
One child form (call it form1) is performing animation based on graphic objects using a timer. This project (child form1) works fine until the other child form (call it form2) is loaded. What happens is that animation on the first form (form1) stops, but when I close this second child form (form2) animation continues with no problem.

I use this code in form2:

private void FlyingBeeForm_Paint(object sender, PaintEventArgs e) {
    Graphics g = e.Graphics; 
    DrawImages(g); 
    System.Threading.Thread.Sleep(50); 
    this.Invalidate(); 
}
  • 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-06-03T15:47:21+00:00Added an answer on June 3, 2026 at 3:47 pm

    The timer is kept going by a notification delivered by Windows when the interval has expired. It is however a very low priority notification, you’ll only get it when no other work needs to be done.

    You now should see the problem with your Paint event handler. For one, you prevent any work from getting done by sleeping constantly. Then you ensure there’s always work to be done by calling Invalidate(). So Windows generates a new paint event and never gets around to the state where a timer event can be delivered.

    You must remove the Sleep and Invalidate call. And use a 50 msec timer instead. Just call Invalidate() in its Tick event handler.

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

Sidebar

Related Questions

I'm writing a windows application using VS2010 and C# 4.0. I have a MDI
I'm writing an application following this tutorial . I'm aware that this tutorial dates,
Writing my first silverlight application. I need to deliver some bitmap that the customer
I'm writing an MDI Application in C#. I'd like a way to store the
So, I'm writing a text editor, using MDI. I have a frame window, child
I am writing a MDI application, I need to add a text editor form
Writing GWT application. I have CellTable and a code that i'v got from google-example
I'm writing an MDI app using Managed dx9. When I create the Device, I
I am writing a MDI Text Editor and I was wondering how can I
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the

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.