Adding an Image to the Main Application Window
To add an image to your main application window:
- In the Solution Explorer, double-click the MainForm.cs file to open it in design mode.
- Drop an mmPictureBox control on the MainForm and rename it to PictureBox.
- Set the Anchor property to None
- Set the Image property to the image you want displayed
- Set the SizeMode property to StretchImage.
- Center the PictureBox control horizontally and vertically (or as desired)
- 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
