2
votes

I am looking for a way to add the Aero functions of Windows back into a bordlerless windows form in Visual Basic 2013. I have coded a custom component for the titlebar to allow be to set my own background/design for it, as well as the minimize, maximize, and close buttons. I am having issues, however, finding a way to make the Windows Aero properties come back, such as:

  • dragging the to the top or sides of the screen to change it's size
  • animations upon resizing/minimizing/maximizing

I am making a custom looking form, such as that found in Google Chrome and Visual Studios. The Aero functionality is my only issue. Does anyone happen to know how to add it to a borderless form in Visual Basic 2013?

1

1 Answers

0
votes

Partial answer that might help:

Without the form borders, the only way I was able to get the resize portion to work was to use panels on all sides use the mouse events to control actions. The panels were transparent, but the mouse enter event would facilitate changing the cursor event as well.

'**************************************************
    'MouseDown = User clicks the button
    'MouseMove = User is holding down the left mouse button and moves the mouse.  Simulates top of a regular form
    'MouseUp = User releases the mouse button 
    '**************************************************
    Private Sub Panel1_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel1.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            drag = True
            mouse_x = Windows.Forms.Cursor.Position.X - Me.Left
            mouse_y = Windows.Forms.Cursor.Position.Y - Me.Top
        End If
    End Sub
    Private Sub Panel1_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel1.MouseMove
        If drag Then
            Me.Top = Windows.Forms.Cursor.Position.Y - mouse_y
            Me.Left = Windows.Forms.Cursor.Position.X - mouse_x
        End If
    End Sub
    Private Sub Panel1_MouseUp(sender As Object, e As MouseEventArgs) Handles Panel1.MouseUp
        drag = False
    End Sub