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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:37:48+00:00 2026-05-18T06:37:48+00:00

I have a form with a panel in which I want to display an

  • 0

I have a form with a panel in which I want to display an animated 3D scene using XNA. What’s the best way to have this panel continuously repainted?

I’m currently thinking about adding a System.Windows.Forms.Timer to the form and adding an event handler to Timer.Tick which updates my 3D scene and calls Invalidate on the panel.

Is there a better way to do this? The rendering isn’t critical, I don’t want the rest of the form to become inresponsive, but on the other hand if there’s time available I would like the rendering to happen at the refresh rate of the monitor.

  • 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-18T06:37:49+00:00Added an answer on May 18, 2026 at 6:37 am

    Yes, a Timer would work. Here’s a clever trick I saw used in a Microsoft example that showed how to use XNA in a Winforms project. It uses the Application.Idle event:

    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);
            Application.Idle += new EventHandler(Application_Idle);
            this.FormClosed += delegate { Application.Idle -= Application_Idle; };
        }
    
        private void Application_Idle(object sender, EventArgs e) { 
            pictureBox1.Invalidate(); 
        }
    
        int cnt;
        void pictureBox1_Paint(object sender, PaintEventArgs e) {
            cnt++;
            e.Graphics.DrawString(cnt.ToString(), this.Font, Brushes.Black, 0, 0);
        }
    }
    

    I used a PictureBox instead of a Panel to hide the flicker, PB has the DoubleBuffered property turned on. That isn’t very relevant to XNA though. Using vsync isn’t going to work afaik. You probably ought to check out that example, the ‘spinning triangle’ was completely smooth without any tearing when I tried it. This thread talks about it.

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

Sidebar

Related Questions

I'm using Ext.Form.Panel successfully but I want to use Ext.form.field.File this time. I was
I have web form with a panel which has form elements in side it.
We have a panel which displays a form with an arbitrary number of JTextFields
I have a simple ExtJs form panel which contains a fileuploadfield. When I submit
I have a custom control which contains a panel, of which I want to
I have a long form which I want to be scrolled at a point
I have Ext.tab.Panel with few items. One item is login panel of type Ext.form.Panel.From
I have a real basic form (code below) with a bunch of back-panel PhP.
I have form with few buttons and I want to know what button is
Guys, I have a windows form with a panel control and inside the panel

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.