Text On Glass Window |
Imports System.Runtime.InteropServices
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Form1_Paint() Handles Me.Paint
Dim g As Graphics = Me.CreateGraphics
Dim tx As New GraphicsPath
'Set black to get nice transparent
Me.BackColor = Color.Black
'Set this form transparent
DwmExtendFrameIntoClientArea(Me.Handle, New MARGINS(-1, -1, -1, -1))
'begin draw text
tx.AddString("Klampok Child", New FontFamily("Tahoma"), FontStyle.Regular, 30,
New Point(12, 12), StringFormat.GenericDefault)
' Set Smoothing Mode to get smooth text
g.SmoothingMode = SmoothingMode.AntiAlias
'Fill form with text and color (brush)
g.FillPath(New SolidBrush(Color.Black), tx)
End Sub
Private Sub Form1_ResizeEnd() Handles Me.ResizeEnd
' When form resize, re-draw the form and show it smooth again
Me.Refresh()
End Sub
' DwmApi To Call Glasses Window
<StructLayout(LayoutKind.Sequential)> _
Public Structure MARGINS
Public LeftWidth As Integer
Public RightWidth As Integer
Public TopHeight As Integer
Public Buttomheight As Integer
Public Sub New(ByVal left As Integer, ByVal right As Integer, ByVal top As Integer, ByVal bottom As Integer)
LeftWidth = left
RightWidth = right
TopHeight = top
Buttomheight = bottom
End Sub
End Structure
<DllImport("dwmapi.dll")> _
Shared Sub DwmExtendFrameIntoClientArea(ByVal hwnd As IntPtr, ByRef mrg As MARGINS)
End Sub
End Class