ToolStrip.LayoutCompleted 事件


發生於 ToolStrip 的配置完成時。Occurs when the layout of the ToolStrip is complete.

 event EventHandler ^ LayoutCompleted;
public event EventHandler LayoutCompleted;
member this.LayoutCompleted : EventHandler 
Public Custom Event LayoutCompleted As EventHandler 




下列程式碼範例將示範如何使用這個成員。The following code example demonstrates the use of this member. 在此範例中,事件處理常式會報告事件的發生情況 LayoutCompletedIn the example, an event handler reports on the occurrence of the LayoutCompleted event. 這份報告可協助您瞭解發生事件的時間,並協助您進行調試。This report helps you to learn when the event occurs and can assist you in debugging. 若要報告多個事件或經常發生的事件,請考慮將取代為 MessageBox.Show Console.WriteLine 或將訊息附加至多行 TextBoxTo report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

若要執行範例程式碼,請將它貼到包含名為之類型實例的專案中 ToolStrip ToolStrip1To run the example code, paste it into a project that contains an instance of type ToolStrip named ToolStrip1. 然後確定事件處理常式與事件相關聯 LayoutCompletedThen ensure that the event handler is associated with the LayoutCompleted event.

private void ToolStrip1_LayoutCompleted(Object sender, EventArgs e) {

   MessageBox.Show("You are in the ToolStrip.LayoutCompleted event.");
Private Sub ToolStrip1_LayoutCompleted(sender as Object, e as EventArgs) _ 
     Handles ToolStrip1.LayoutCompleted

   MessageBox.Show("You are in the ToolStrip.LayoutCompleted event.")

End Sub


當專案不符合內的專案時 ToolStrip ,就會自動顯示溢位按鈕。When items do not fit within the ToolStrip, an overflow button automatically appears. Overflow屬性設定會決定專案是否一律出現在溢位區域中(如有需要或永遠不出現)。The Overflow property setting determines whether an item appears in the overflow area always, as needed, or never.

檢查 Placement 事件中的屬性, LayoutCompleted 以判斷專案是否放在主要 ToolStrip 、溢位 ToolStrip 或目前未顯示。Inspect the Placement property in the LayoutCompleted event to determine whether an item was placed on the main ToolStrip, the overflow ToolStrip, or if it is not currently showing at all. 專案未顯示的一般原因是專案不符合主專案 ToolStrip ,而且其 Overflow 屬性設定為 NeverThe typical reasons why an item is not displayed are that the item did not fit on the main ToolStrip and its Overflow property was set to Never.

如需處理事件的詳細資訊,請參閱 處理和引發事件For more information about handling events, see Handling and Raising Events.