Original MDI background image

I've tried absolutely everything I can and it doesn't work! Has anyone ever solved this problem?

I can put my image in the back, but it only works if the shape never tries to be resized (shrinking is ok, growing leaves an empty gray space ...)

+2


source to share


7 replies


A long time ago, I found there is a simple answer for this problem, using a panel as an MDI container.



0


source


Two options:



  • Set the background image and change the BackgroundImageLayout Property to Stretch (as suggested by Guster_Q )
  • Set the image in imagecontrol mode and set its docking property to fill
+3


source


I tried the shape change event and it worked for me like this:

        private void Main_Resize(object sender, EventArgs e)
    {
        this.BackgroundImage = Properties.Resources.stockandinventorymanagement;
    }

      

+3


source


Change the BackgroundImageLayout property to Stretch. This will stretch your image to always fill the background space.

0


source


Set RightToLeftLayout property to FALSE

0


source


Try this code:

IMPORTANT: the 'BackgroundImageLayout' property of the form must be equal to the code


        Dim ctl As Control

        For Each ctl In Me.Controls

            If TypeOf ctl Is MdiClient Then
                ctl.BackColor = Color.Yellow
                ctl.BackgroundImageLayout = ImageLayout.Stretch
                ctl.BackgroundImage = Image.FromFile("C:\Image.png")
            End If

        Next

      

0


source


Thanks for the idea!!!! it's too easy, just change the background of the panel and put this below C # code:

Form2 frm = new Form2();
        frm.TopLevel = false;
        panel1.Controls.Add(frm);
        frm.Show();

      

this for vb.net

    Dim frm  = New Form2
    frm .TopLevel = False
    Panel1.Controls.Add(frm )
    frm .Show()

      

0


source







All Articles