How to prevent a Windows Forms TextBox from flickering on resize?
.net, flicker, winforms
Solution
I usually use a RichTextBox instead of a multiline TextBox. By setting the DetectUrls- and ShortcutsEnabled-properties to false the RTB behaves very similar to a TextBox and ... it's flicker-free.
Problem
There are plenty of articles addressing flicker in Windows Forms. The majority recommend setting `DoubleBuffered = true` or setting a bunch of `ControlStyle` flags. However, none of these help reduce a TextBox flickering. Here are a couple of related questions: - How to double buffer .NET controls on a form? - How to eliminate flicker in Windows.Forms custom control when scrolling? To reproduce the issue, create a new WinForms project, add a `TextBox`, enable multi-line, disable word-wrap, add a bunch of text, set `Anchor` to Left+Right+Top+Bottom. Now run and resize. The text flickers. For text boxes inside a couple of nested `TableLayoutPanel`s the flicker on resize is even worse. Applying the solutions proposed in the above questions at best do not fix the flicker; if I get experimental and set the protected `ControlStyle` on `TextBox` I can break it completely (by enabling `UserPaint`) but not eliminate the flicker. So, is there any way at all to fix the flickering of the text in a TextBox?