# Region adds background to the MDI parent form and solves the problem of blinking
// 1. Add a background image named "backgroundimage" to properties/resources. resx.
// 2. Add backgroundnosplash () in the following locations ();
Public frmmain ()
{
Initializecomponent ();
// Add background to the MDI parent form and solve the problem of blinking
Backgroundnosplash ();
}
// The followingCodeCopy to the MDI main form code
Mdiclient = new mdiclient ();
Private void backgroundnosplash ()
{
Foreach (control VaR in this. Controls)
{
If (VaR is mdiclient)
{
Mdiclient = VaR as mdiclient;
Break;
}
}
If (mdiclient! = NULL)
{< br> mdiclient. paint + = new painteventhandler (onmdiclientpaint);
system. reflection. methodinfo MI = (mdiclient as control ). getType (). getmethod ("setstyle", system. reflection. bindingflags. nonpublic | system. reflection. bindingflags. instance);
mi. invoke (mdiclient, new object [] {controlstyles. allpaintinginwmpaint | controlstyles. userpaint | controlstyles. optimizeddoublebuffer
| controlstyles. resizeredraw, true});
}< BR >}
Private void onmdiclientpaint (Object sender, painteventargs E)
{
Graphics G = E. graphics;
G. drawimage (properties. Resources. backgroundimage, new rectangle (0, 0, mdiclient. Width, mdiclient. Height ));
String MSG = "system name + version number + last update date ";
Sizef size = E. Graphics. measurestring (MSG, this. font );
G. drawstring (MSG, this. Font, new solidbrush (color. White), mdiclient. Width-size. Width, mdiclient. Height-size. Height );
}
# endregion