2

我正在寻找一种将 Windows 的 Aero 功能重新添加到 Visual Basic 2013 中的无边框窗体中的方法。我为标题栏编写了一个自定义组件,以允许为其设置我自己的背景/设计,以及最小化、最大化和关闭按钮。但是,我遇到了问题,想办法让 Windows Aero 属性恢复,例如:

  • 将 拖动到屏幕的顶部或两侧以更改其大小
  • 调整大小/最小化/最大化时的动画

我正在制作一个自定义外观表单,例如在 Google Chrome 和 Visual Studios 中找到的表单。Aero 功能是我唯一的问题。有谁碰巧知道如何将它添加到 Visual Basic 2013 中的无边框表单中?

4

1 回答 1

0

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
于 2016-12-08T23:42:32.100 回答