Adding an Image to the Main Application Window

To add an image to your main application window:

  1. In the Solution Explorer, double-click the MainForm.cs file to open it in design mode.

  2. Drop an mmPictureBox control on the MainForm and rename it to PictureBox.

  3. Set the Anchor property to None

  4. Set the Image property to the image you want displayed

  5. Set the SizeMode property to StretchImage.

  6. Center the PictureBox control horizontally and vertically (or as desired)

  7. Add the following methods to the MainForm class. This code automatically hides the PictureBox when a form is launched, and automatically shows it when no forms are open on the desktop.

    In C#:

    public override void ShowDesktopImage()
    {
    	this.PictureBox.Visible = true;
    }
    
    public override void HideDesktopImage()
    {
    	this.PictureBox.Visible = false;
    }

    In VB .NET:

    Public Overrides Sub ShowDesktopImage()
       Me.PictureBox.Visible = True
    End Sub
    
    
    Public Overrides Sub HideDesktopImage()
       Me.PictureBox.Visible = False
    End Sub


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 09/23/17
Comment or report problem with topic