Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Partial Class Form1
- Inherits Form
- Public Sub New()
- InitializeComponent()
- Me.FormBorderStyle = FormBorderStyle.None
- Me.DoubleBuffered = True
- Me.SetStyle(ControlStyles.ResizeRedraw, True)
- End Sub
- Private Const cGrip As Integer = 16
- Private Const cCaption As Integer = 32
- Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- Dim rc As Rectangle = New Rectangle(Me.ClientSize.Width - cGrip, Me.ClientSize.Height - cGrip, cGrip, cGrip)
- ControlPaint.DrawSizeGrip(e.Graphics, Me.BackColor, rc)
- rc = New Rectangle(0, 0, Me.ClientSize.Width, cCaption)
- e.Graphics.FillRectangle(Brushes.DarkBlue, rc)
- End Sub
- Protected Overrides Sub WndProc(ByRef m As Message)
- If m.Msg = &H84 Then
- Dim pos As Point = New Point(m.LParam.ToInt32())
- pos = Me.PointToClient(pos)
- If pos.Y < cCaption Then
- m.Result = CType(2, IntPtr)
- Return
- End If
- If pos.X >= Me.ClientSize.Width - cGrip AndAlso pos.Y >= Me.ClientSize.Height - cGrip Then
- m.Result = CType(17, IntPtr)
- Return
- End If
- End If
- MyBase.WndProc(m)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement