本文整理汇总了VB.NET中System.Windows.Forms.Layout.LayoutEngine.Layout方法的典型用法代码示例。如果您正苦于以下问题:VB.NET LayoutEngine.Layout方法的具体用法?VB.NET LayoutEngine.Layout怎么用?VB.NET LayoutEngine.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Layout.LayoutEngine
的用法示例。
在下文中一共展示了LayoutEngine.Layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Layout
Public Overrides Function Layout( _
ByVal container As Object, _
ByVal layoutEventArgs As LayoutEventArgs) As Boolean
Dim parent As Control = container
' Use DisplayRectangle so that parent.Padding is honored.
Dim parentDisplayRectangle As Rectangle = parent.DisplayRectangle
Dim nextControlLocation As Point = parentDisplayRectangle.Location
Dim c As Control
For Each c In parent.Controls
' Only apply layout to visible controls.
If c.Visible <> True Then
Continue For
End If
' Respect the margin of the control:
' shift over the left and the top.
nextControlLocation.Offset(c.Margin.Left, c.Margin.Top)
' Set the location of the control.
c.Location = nextControlLocation
' Set the autosized controls to their
' autosized heights.
If c.AutoSize Then
c.Size = c.GetPreferredSize(parentDisplayRectangle.Size)
End If
' Move X back to the display rectangle origin.
nextControlLocation.X = parentDisplayRectangle.X
' Increment Y by the height of the control
' and the bottom margin.
nextControlLocation.Y += c.Height + c.Margin.Bottom
Next c
' Optional: Return whether or not the container's
' parent should perform layout as a result of this
' layout. Some layout engines return the value of
' the container's AutoSize property.
Return False
End Function