Onpaint events (invalid) change the order of execution after a period of normal operation (runtime)

I have 3 data graphics that are painted through their paint events. When I have data that I need to insert into the chart, I call the invalidate () control command.

The first image control event actually creates a bitmap buffer for the other two charts to avoid repeating a long cycle.

Thus, invalidate commands are in a specific order (1,2,3). This works well, however, when the graphic data reaches the end of the chart window (PictureBox), where the data usually starts scrolling, the drawing events start to shoot in the wrong order (2,3,1).

Has anyone come across this before? why can this happen?

+3
source share
2 answers

Modify your code so that before calling Invalidateany of the three controls, one common raster buffer is created (presumably as a static member of your control class), and then call Invalidateon each of the controls.You Paintcan use a static bitmap buffer inside the control , and it doesn't matter in what order the event fires Paint.

Invalidate , , WM_PAINT . Windows, , , Windows . , .

, : Paint ( , Paint), , - , , Invalidate, , .

(a Bitmap PictureBox - ), Paint ( Graphics.DrawImage BitBlt - ).

, , , ( " " ). . Paint .

+5

Invalidate() , , .

Invalidate() , , , . , -, . , - , , . , . , Control 1 , . .

+3

Source: https://habr.com/ru/post/1740608/


All Articles