1
public
frmMain()
2 {
3 InitializeComponent();
4 foreach (Control var in this .Controls)
5 {
6 if (var is MdiClient)
7 {
8 mdiClient = var as MdiClient;
9 break ;
10 }
11 }
12
13 if (mdiClient != null )
14 {
15 mdiClient.Paint += new PaintEventHandler(OnMdiClientPaint);
16 System.Reflection.MethodInfo mi = (mdiClient as Control).GetType().GetMethod( " SetStyle " , System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
17 mi.Invoke(mdiClient, new object [] { ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer
18 | ControlStyles.ResizeRedraw, true });
19
20 }
21 }
22
23 private void OnMdiClientPaint( object sender, PaintEventArgs e)
24 {
25 Graphics g = e.Graphics;
26 g.DrawImage(Properties.Resources.BackgroundImage, new Rectangle( 0 , 0 , mdiClient.Width, mdiClient.Height));
27 string msg = "wuChang@guet.edu.cn " ;
28 SizeF size = e.Graphics.MeasureString(msg, this .Font);
29 g.DrawString(msg, this .Font, new SolidBrush(Color.White), mdiClient.Width - size.Width, mdiClient.Height - size.Height);
30
31 }
2 {
3 InitializeComponent();
4 foreach (Control var in this .Controls)
5 {
6 if (var is MdiClient)
7 {
8 mdiClient = var as MdiClient;
9 break ;
10 }
11 }
12
13 if (mdiClient != null )
14 {
15 mdiClient.Paint += new PaintEventHandler(OnMdiClientPaint);
16 System.Reflection.MethodInfo mi = (mdiClient as Control).GetType().GetMethod( " SetStyle " , System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
17 mi.Invoke(mdiClient, new object [] { ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer
18 | ControlStyles.ResizeRedraw, true });
19
20 }
21 }
22
23 private void OnMdiClientPaint( object sender, PaintEventArgs e)
24 {
25 Graphics g = e.Graphics;
26 g.DrawImage(Properties.Resources.BackgroundImage, new Rectangle( 0 , 0 , mdiClient.Width, mdiClient.Height));
27 string msg = "wuChang@guet.edu.cn " ;
28 SizeF size = e.Graphics.MeasureString(msg, this .Font);
29 g.DrawString(msg, this .Font, new SolidBrush(Color.White), mdiClient.Width - size.Width, mdiClient.Height - size.Height);
30
31 }