Creating transparent controls that can handle mouse events
Creating transparent controls that can handle mouse events <URL:http://dotnet.mvps.org/dotnet/faqs/?id=transparentcontrol&lang=en> ---------------------------------------------------------------------------- Creating transparent controls that can handle mouse events The class 'TransparentControl' provides a control that is fully transparent without loosing the ability to handle the control's events. This is archieved by adjusting the control's extended style bits: \\\ Imports System Imports System.Windows.Forms Public Class TransparentControl Inherits Control Private Const WS_EX_TRANSPARENT As Int32 = &H20 Public Sub New() Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True) Me.UpdateStyles() Me.BackColor = Color.Transparent End Sub Protected Overrides ReadOnly Property CreateParams() As CreateParams Get Dim cp As CreateParams = MyBase.CreateParams cp.ExStyle = cp.ExStyle Or WS_EX_TRANSPARENT Return cp End Get End Property Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs) ' End Sub End Class ///