项目中应用程序用了张背景图片,使用tile方式。一直有闪烁问题。
here is some comments in MSDN:
You can increase performance for large images if you set BackgroundImageLayout to something other than Tile.
So I changed backgroundInmageLayout to Center. But the background color is using the color setting Control panel for MDI application. so need to cast the main window as child window and set the background color, do the following code in form load event handler:
- MdiClient ctlMDI;
- // Loop through all of the form's controls looking
- // for the control of type MdiClient.
- foreach (Control ctl in this.Controls)
- {
- try
- {
- // Attempt to cast the control to type MdiClient.
- ctlMDI = (MdiClient)ctl;
- // Set the BackColor of the MdiClient control.
- ctlMDI.BackColor = Color.White;
- }
- catch (InvalidCastException exc)
- {
- // Catch and ignore the error if casting failed.
- }
- }