I realize there are a ton of questions floating around the internet about reducing flicker in Windows Forms applications. After copious experimentation, I found that the solution in my particular case was quite straightforward: setting the Control.DoubleBuffered
property to true for the controls that were exhibiting flicker. I accomplished this by simply deriving from the necessary control classes (in my case, from ListView
to DoubleBufferedListView
and from DataGridView
to DoubleBufferedDataGridView
).
The primary culprit in the app I am working on is a DataGridView
which updates many of its cells on the Tick
event of a Windows.Forms.Timer
object. Before enabling double buffering, the grid would flicker slightly (not too bad, but enough to be noticeable) on most updates. After enabling double buffering, the flicker went away.
However, I'm talking about my development machine here. Unfortunately, this app is actually run by end users via a Remote Desktop connection, which I learned from this blog post by Raymond Chen means I should not use double buffering.
My question, then, is: what should I use? Chen suggests switching between a double buffered approach on local machines and the traditional non-double buffered approach on remote desktop connections; but in that case the end users of this app will still experience the flicker. Is this simply unavoidable?
For the record: this is not a simple matter of calling BeginUpdate
/EndUpdate
(already doing that on ListBox
and ListView
controls) or SuspendLayout
/ResumeLayout
(already doing that for the DataGridView
control as well, although I don't think that's even particularly important since, as I said, I'm just updating the values in certain cells).
Maybe a flicker-free remote desktop app is simply impossible?