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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:41:05+00:00 2026-05-14T04:41:05+00:00

I have 3 data graphs that are painted via the their paint events. When

  • 0

I have 3 data graphs that are painted via the their paint events.
When I have data that I need to insert into the graph I call the controls invalidate() command.

The first control’s paint event actually creates a bitmap buffer for the other 2 graphs to avoid repeating a long loop.

So the invalidate commands are in a specific order (1,2,3). This works well, however when the graphed data reaches the end of the graph window (PictureBox) where the data would normally start scrolling, the paint events begin firing in the wrong order (2,3,1).

has anyone came across this before? why might this be happening?

  • 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-14T04:41:05+00:00Added an answer on May 14, 2026 at 4:41 am

    Change your code so that before calling Invalidate on any of the three controls, you create the one shared bitmap buffer (conceivably as a static member of your control class), and then call Invalidate on each of the controls. Within the control’s Paint event you can then use the static bitmap buffer, and it won’t matter in which order the Paint events fire.

    When you call Invalidate on a control, you’re basically telling the OS to send a WM_PAINT message to that control. Because it’s a Windows message, it’s guaranteed to be delivered whenever Windows gets around to doing it. In your case, they’re usually delivered in the order received, but sometimes they just won’t be.

    One other thing to consider with your code: when you place relatively complex drawing code inside your control’s Paint event handler (or inside a method called directly from the Paint event handler), this code will execute whenever the control is invalidated for any reason, meaning that the code will run when you call Invalidate, but it will also run whenever another window is dragged over the control.

    For complex, time-consuming graphics, it’s always best to perform the complex rendering on a hidden buffer (a Bitmap or an invisible PictureBox or whatever), and then in the control’s Paint event do a simple copy from the hidden buffer to the visible window (using Graphics.DrawImage or BitBlt or whatever).

    This approach also allows you to avoid flicker, if you add a second buffer in between the buffer you draw on and the visible window (hence “double buffering”). After you complete drawing on the main buffer, you copy it onto the second buffer. In the control’s Paint event, you copy from the second buffer onto the visible window.

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

Sidebar

Related Questions

So... I have some little flash graphs I made that pull data from an
Here's my situation. I have a graph that has different sets of data being
I have a graph library that I use to plot some data. This data
I have a data structure that represents a directed graph and I'm looking for
I have some data in CSV format that I want to pull into an
I have to make an application that uses Graphs (Data Structure) but I don't
I have a data structure that represents a directed graph, and I want to
I have external data that I'd like to make into a pie chart with
I have several graphs created by RRDTool that collected bad data during a time
I have been playing around with using graphs to analyze big data. Its been

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.