本文整理匯總了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