Charles,
* "Charles Law said:
I was beginning to think I had become invisible. I seem to have a lot of
posts unanswered at the moment - I don't suppose you would care to take a
look?
Anyway, back to the point. A good solution if I had started from there, but
as you may have gathered from my other replies, I haven't.
I wonder how the IDE does it, or SharpDevelop, for that matter. I have
looked at their code but I will never find it in there; there's loads of it.
\\\
Imports System
Imports System.Windows.Forms
Public Class UserControl1
Inherits Control
Private Declare Auto Function GetWindowLong Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nIndex As Int32) As Int32
Private Declare Auto Function SetWindowLong Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nIndex As Int32, ByVal dwNewLong As Int32) As Int32
Private Const GWL_EXSTYLE As Int32 = -20
Private Const WS_EX_TRANSPARENT As Int32 = &H20
Public Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparent
End Sub
Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
Dim nStyle As Int32 = GetWindowLong(Me.Handle, GWL_EXSTYLE)
nStyle = nStyle Or WS_EX_TRANSPARENT
Call SetWindowLong(Me.Handle, GWL_EXSTYLE, nStyle)
End Sub
Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
'
End Sub
End Class
///
Add an instance of this class to your form's controls and place it in
front of all other controls.