I will add more of an explanation later.
This is how you can remove the border and set the backcolor of the MDIClient control, which is the control that is automatically added to your form when you set its IsMdiContainer property to True.
Add the following inside your class:
vb.net Code:
Private Declare Auto Function SetWindowLong Lib "User32.Dll" (ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer Private Declare Auto Function GetWindowLong Lib "User32.Dll" (ByVal hWnd As System.IntPtr, ByVal nIndex As Integer) As Integer Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_CLIENTEDGE = &H200
Then add the following to the MDI Parent's load event:
vb.net Code:
' SET BACKGROUND COLOR AND REMOVE BORDER FROM MDICLIENT CONTROL For Each c As Control In Me.Controls() If TypeOf (c) Is MdiClient Then c.BackColor = Color.DimGray Dim windowLong As Integer = GetWindowLong(c.Handle, GWL_EXSTYLE) windowLong = windowLong And (Not WS_EX_CLIENTEDGE) SetWindowLong(c.Handle, GWL_EXSTYLE, windowLong) c.Width = c.Width + 1 Exit For End If Next




Reply With Quote