Option Explicit Const LW_KEY = &H1 Const G_E = (-20) Const W_E = &H80000 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function ReleaseCapture Lib "user32.dll" () As Long Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long Private Const LWA_ALPHA = &H2 Private Const GWL_EXSTYLE = (-20) Private Const LWA_COLORKEY = &H1 Private Const ULW_COLORKEY = &H1 Private Const ULW_ALPHA = &H2 Private Const ULW_OPAQUE = &H4 Private Const WS_EX_LAYERED = &H80000 Private Sub Form_Load() Dim Ret As Long Dim TC As Long TC = &HC000C0 Ret = GetWindowLong(Me.hwnd, G_E) Ret = Ret Or W_E SetWindowLong Me.hwnd, G_E, Ret Me.BackColor = TC SetLayeredWindowAttributes Me.hwnd, TC, 0, LWA_COLORKEY End Sub
Quote:Well, MDI child forms don't support independent transparency. An MDI child form is actually a child control of the MDI parent so, just like all other child controls, their transparency depends on the parent form. You can set the TransparencyKey of the parent and then, if that color is present on the child (You can use another pictureBox to do this on child form), you'll see right through both of them. It's not possible to set the TransparencyKey of the child and see through to the parent though.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)