如何实现mdi窗口中显示图片上部居中

本来实现思路是加一个图片框控件

MdiClient不支持添加图片框控件

添加到mdi窗口中,就会在所有的子窗口的上面

      try
            {
                if (System.IO.File.Exists(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "wfp_form_adv.jpg")))
                {
                    byte[] mybyte = System.IO.File.ReadAllBytes(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "wfp_form_adv.jpg"));

                    this.BackgroundImage = Image.FromStream(new MemoryStream(mybyte));
                 //   this.BeginInvoke(new EventHandler(movePic), mybyte);
                }
            }
            catch { }

 private void movePic(object sender, EventArgs e)
        {
            mypic.Image = Image.FromStream(new MemoryStream((byte[])(sender)));
            mypic.Left = (this.Width - mypic.Width) / 2;
        }

   PictureBox mypic = new PictureBox();

      mypic.SizeMode = PictureBoxSizeMode.AutoSize;
            mypic.Top = 0;
            mypic.SendToBack();

   this.Controls.Add(mypic);

可以显示图片,但是这个方案还是不行!

你可能感兴趣的:(图片)