0

I am trying to layer objects using winform with each usercontrol having ~50 items(buttons/textbox/labels) on them.

I have tried to enable doublebuffering as recommended and the use of

this.SuspendLayout();
\\... Code ....
this.ResumeLayout();

But there are still a lot of visual artifacts when rendering the items, when the objects are being brought forward.

Identified Potential Issue 1 [I have too much code in the GUI Thread]:

I do have a lot of timers running and I am not sure how to check. However, all the timers are implemented using System.Timer.Timer and intitialised using a ISynchroizeInvoke object. Not sure how I can do a better job with this.

albusSimba
  • 441
  • 4
  • 14
  • You need a more precise description of what happens, in practice. -- *I have tried to enable doublebuffering*: on what? -- *However, all the timers are implemented using System.Timer.Timer*: what does *However* means, in your view? That threaded Timer with `ISynchroizeInvoke` set it the same as the System.Windows.Forms.Timer, the `Elapsed` event is raised in the UI Thread. <- What are these Timers (more than one per UC?) doing? Are these related to custom drawing? Are you custom-drawing *something*? If so, what / how / when? Something else that impacts the Layout / Graphics? Etc. – Jimi Jul 06 '21 at 12:46
  • You could also post an animation of the drawing issues you're experiencing. Get, e.g., [ScreenToGif](https://github.com/NickeManarin/ScreenToGif/releases), if you don't have it. – Jimi Jul 06 '21 at 12:47
  • I can't provide a gif becos it's on a locked down computer. double buffering is for the main form and individual objects. these timer processes data and repaints the form if the data is updated. the artifacts are like blank text boxes and buttons which would load like 0.3 seconds to load. I am just looking at how if possible to avoid that if not I can live with it. – albusSimba Jul 06 '21 at 16:13
  • Your description of the problem is too vague. Also, there's no code at all that explains what is going on inside your Controls, or any detail related to what the Timers are doing, whether you have custom drawing anywhere and what is being drawn when the Control is invalidated. So, it's fairly impossible to suggest anything meaningful. – Jimi Jul 06 '21 at 18:07

0 Answers0