Public Class LayerWindow
Inherits Form
Private Const WS_EX_TRANSPARENT As Integer = 32
Private Const WS_EX_LAYERED As Integer = 524288
Public Sub New()
MyBase.SetStyle(ControlStyles.Opaque, True)
Me.Bounds = New Rectangle(0, 0, 0, 0)
Dim r As Rectangle = TryCast(Screen.FromHandle(Me.Handle), Screen).Bounds
MyBase.TopMost = True
MyBase.StartPosition = FormStartPosition.Manual
MyBase.FormBorderStyle = FormBorderStyle.None
MyBase.ShowInTaskbar = False
MyBase.BackColor = Color.Black
MyBase.TransparencyKey = Color.Black
MyBase.ShowIcon = False
Me.Bounds = r
End Sub
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim SecPerm As New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
SecPerm.Demand()
Dim cp As System.Windows.Forms.CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or WS_EX_LAYERED
cp.ExStyle = cp.ExStyle Or WS_EX_TRANSPARENT
Return cp
End Get
End Property
' لا ترسم اي شئ في االأحداث الخاصة برسم الفورم حتي لا تظهر علي الشاشة
Protected Overrides Sub OnPaint(e As PaintEventArgs)
End Sub
Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
End Sub
' عليك فقط ان تتعامل مع لوحة المفاتيح في الحدث الخاص بها
End Class