Post

Don't Let Windows Forms Bite You

I just recently understand how heavily Windows Forms depends on native Windows components and why switching to WPF is nice for developers in some scenarios. So the story goes.

Do you know that if you use RichTextBox in your application .NET Framework automatically sets a dependency on riched20.dll? And for some reason such a dependency can be very harmful, and many people suffer.

When you append certain text into the box, riched20.dll may spend a surprisingly long time and one of your CPU cores to do its task and ignore your anger.

This may be acceptable on multi-core machines, but what if your machine has only one core?

:) So next time please use a simple TextBox instead (TextBox does not rely on riched20.dll), or switch to WPF/Silverlight.

Is there any other well-known Windows Forms issue like this one?

© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.
Advertisement

© - Lex Li. All rights reserved.

Using the Chirpy theme for Jekyll.

Last updated on April 19, 2024