ToolStrip.LayoutCompleted ToolStrip.LayoutCompleted ToolStrip.LayoutCompleted ToolStrip.LayoutCompleted Event


發生於 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. 在範例中,事件處理常式會報告一次LayoutCompleted事件。In 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. 請確定 與關聯的事件處理常式LayoutCompleted事件。Then 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.