Set MDIForm background image

Try this. Obviously, change the path to whatever bitmap you want to load and display.

Visual Basic:
    Private backgroundBitmap As Bitmap

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim c As Control

        backgroundBitmap = New Bitmap("c:\windows\coffee bean.bmp")

        For Each c In Controls
            If TypeOf c Is MdiClient Then
                AddHandler c.Paint, AddressOf PaintMyImage
                Exit For
            End If
        Next
    End Sub

    Private Sub PaintMyImage(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
        e.Graphics.DrawImage(backgroundBitmap, 0, 0)
    End Sub
 
Back
Top