Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

How to prevent OnEraseBkgnd effect in C# applications

, 13 May 2012
Rate this:
Please Sign up or sign in to vote.
how to make sure background is not painted in C#


Coming from a more win32 background, I found some things a little different while I was working with C#. Preventing Background painting effect (that is seen with WM_ERASEBKGND in win32 applications) was one such tricky operations.

How to !EraseBkgnd

The solution in the end was simple.

Just add the following line after InitializeComponent of a form:

this.SetStyle(ControlStyles.Opaque, true);   

Further Read


Tip uploaded : 14th May, 2012.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mukit, Ataul
Chief Technology Officer Rational Technologies
Bangladesh Bangladesh
You don't learn patterns, you just code it.
Follow on   Twitter

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 14 May 2012
Article Copyright 2012 by Mukit, Ataul
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid