怎么让MDI主窗口的背景改变啊。。就是背景图片 。。

解决方案 »

  1.   

    this.BackgroundImage = Image.FromFile("...");
      

  2.   

    2005  有  BackgroundImage  属性的!
      

  3.   

    这个是我的一个程序里面的
    MDI窗口的背景 vb.net写的
     '获取并绘制MDI窗口的背景图
        Private Sub getmdipic()
            Dim mycontrol As Control
            Dim bgmdiclient As MdiClient
            Dim myimage As Bitmap
            Dim bgimage As Bitmap
            '路径
            Dim imgurl As String
            Dim myGraphics As Graphics
            '绘制方式
            Dim drawtype As String        Try
                drawtype = func.GetKeyVal(inipath, "BgImg", "showtype")
                imgurl = Application.StartupPath & "\bgimg\" & func.GetKeyVal(inipath, "BgImg", "img")
                For Each mycontrol In Me.Controls
                    If mycontrol.GetType.ToString = "System.Windows.Forms.MdiClient" Then
                        bgmdiclient = mycontrol
                        Exit For
                    End If
                Next
                bgimage = Bitmap.FromFile(imgurl)
                Select Case drawtype
                    '平铺方式
                Case "1"
                        myimage = New Bitmap(bgmdiclient.ClientSize.Width, bgmdiclient.ClientSize.Height)
                        myGraphics = Graphics.FromImage(myimage)
                        myGraphics.DrawImage(bgimage, 0, 0, myimage.Width + 1, myimage.Height + 1)
                        bgmdiclient.BackgroundImage = myimage
                        myGraphics.Dispose()
                        '拉伸方式
                    Case "2"
                        bgmdiclient.BackgroundImage = bgimage
                    Case Else
                        bgmdiclient.BackgroundImage = bgimage
                End Select
            Catch ex As Exception
                Exit Sub
            End Try
        End Sub