我不确定您是否可以覆盖边框的绘制,以及您是否不确定如何将控件添加到边框。
您可以在最大化表单之前临时更改边框样式。您可以重载客户端事件以自己处理重新调整表单大小。
你还有其他不想去的理由Formborderstyle.none
吗?
Public Class Form1
Inherits Windows.Forms.Form
Private Const BorderWidth As Integer = 30 'This is just for demo purposes.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Panel1.Location = New Point(Me.Width - BorderWidth, 0)
Panel1.Width = BorderWidth
End Sub
Public xLocation, yLocation As Integer
Private Sub Panel1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
xLocation = PointToScreen(Cursor.Position).X
yLocation = PointToScreen(Cursor.Position).Y
End Sub
Private Sub Panel1_MouseUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
'Stop resizing form
Me.Width = Me.Width + (PointToScreen(Cursor.Position).X - xLocation)
xLocation = PointToScreen(Cursor.Position).X
yLocation = PointToScreen(Cursor.Position).Y
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
Me.WindowState = FormWindowState.Maximized
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
End Class