ToolStripItem.Overflow ToolStripItem.Overflow ToolStripItem.Overflow ToolStripItem.Overflow Property

Definition

Ruft einen Wert ab, der angibt, ob das Element an den ToolStrip oder den ToolStripOverflowButton angefügt wird bzw. ob es sich dazwischen befinden kann, oder legt diesen Wert fest.Gets or sets whether the item is attached to the ToolStrip or ToolStripOverflowButton or can float between the two.

public:
 property System::Windows::Forms::ToolStripItemOverflow Overflow { System::Windows::Forms::ToolStripItemOverflow get(); void set(System::Windows::Forms::ToolStripItemOverflow value); };
public System.Windows.Forms.ToolStripItemOverflow Overflow { get; set; }
member this.Overflow : System.Windows.Forms.ToolStripItemOverflow with get, set
Public Property Overflow As ToolStripItemOverflow

Eigenschaftswert

Ausnahmen

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie die TextEigenschaften Overflow, und TextDirection festgelegt werden und wie Click das-Ereignis behandelt wird.The following code example demonstrates how to set the Text, Overflow, and TextDirection properties, and handle the Click event. Fügen Sie zum Ausführen dieses Beispiels den folgenden Code in ein Formular ein, das ToolStrip einen movingToolStrip InitializeMovingToolStrip mit dem Namen und einen-Befehl im Konstruktor oder Load Ereignishandler des Formulars enthält.To run this example, paste the following code into a form that contains a ToolStrip named movingToolStrip and call InitializeMovingToolStrip in the form's constructor or Load event handler.

ToolStripButton^ changeDirectionButton;

void InitializeMovingToolStrip()
{
    changeDirectionButton = gcnew ToolStripButton;
    movingToolStrip->AutoSize = true;
    movingToolStrip->RenderMode = ToolStripRenderMode::System;
    changeDirectionButton->TextDirection = 
        ToolStripTextDirection::Vertical270;
    changeDirectionButton->Overflow = 
        ToolStripItemOverflow::Never;
    changeDirectionButton->Text = "Change Alignment";
    movingToolStrip->Items->Add(changeDirectionButton);
    changeDirectionButton->Click += gcnew EventHandler(this, 
        &Form1::changeDirectionButtonClick);
}

void changeDirectionButtonClick(Object^ sender, EventArgs^ e)
{
    ToolStripItem^ item = (ToolStripItem^) sender;
    if ((item->TextDirection == ToolStripTextDirection::Vertical270) 
        || (item->TextDirection == ToolStripTextDirection::Vertical90))
    {
        item->TextDirection = ToolStripTextDirection::Horizontal;
        movingToolStrip->Raft = RaftingSides::Top;
    }
    else
    {
        item->TextDirection = 
            ToolStripTextDirection::Vertical270;
        movingToolStrip->Raft = RaftingSides::Left;
    }
}


internal ToolStripButton changeDirectionButton;

private void InitializeMovingToolStrip()
{
          movingToolStrip = new ToolStrip();

	changeDirectionButton = new ToolStripButton();

	movingToolStrip.AutoSize = true;
	movingToolStrip.RenderMode = ToolStripRenderMode.System;

	changeDirectionButton.TextDirection = ToolStripTextDirection.Vertical270;
	changeDirectionButton.Overflow = ToolStripItemOverflow.Never;
	changeDirectionButton.Text = "Change Alignment";
		movingToolStrip.Items.Add(changeDirectionButton);
}


private void changeDirectionButton_Click(object sender, EventArgs e)
{

	ToolStripItem item = (ToolStripItem)sender;

	if (item.TextDirection == ToolStripTextDirection.Vertical270 || item.TextDirection == ToolStripTextDirection.Vertical90)
	{
		item.TextDirection = ToolStripTextDirection.Horizontal;
		movingToolStrip.Dock = System.Windows.Forms.DockStyle.Top;
	}
	else
	{
		item.TextDirection = ToolStripTextDirection.Vertical270;
		movingToolStrip.Dock = System.Windows.Forms.DockStyle.Left;
	}

}
Friend WithEvents changeDirectionButton As ToolStripButton

Private Sub InitializeMovingToolStrip()
    changeDirectionButton = New ToolStripButton()

    movingToolStrip.AutoSize = True
    movingToolStrip.RenderMode = ToolStripRenderMode.System

    changeDirectionButton.TextDirection = ToolStripTextDirection.Vertical270
    changeDirectionButton.Overflow = ToolStripItemOverflow.Never
    changeDirectionButton.Text = "Change Alignment"
    movingToolStrip.Items.Add(changeDirectionButton)
End Sub


Public Sub changeDirectionButton_Click(ByVal sender As Object, _
    ByVal e As EventArgs) Handles changeDirectionButton.Click

    Dim item As ToolStripItem = CType(sender, ToolStripItem)

    If item.TextDirection = ToolStripTextDirection.Vertical270 _
        OrElse item.TextDirection = ToolStripTextDirection.Vertical90 Then

        item.TextDirection = ToolStripTextDirection.Horizontal
        movingToolStrip.Dock = System.Windows.Forms.DockStyle.Top
    Else
        item.TextDirection = ToolStripTextDirection.Vertical270
        movingToolStrip.Dock = System.Windows.Forms.DockStyle.Left
    End If

End Sub

Hinweise

Verwenden Sie Overflow die-Eigenschaft in Stapel Layouts.Use the Overflow property in stack layouts. In Flow-und Tabellenlayouts wird ToolStrip die Überlauf Schaltfläche nicht gerendert Overflow , und daher wird die-Eigenschaft ignoriert.In flow and table layouts, the ToolStrip overflow button is not rendered, and therefore the Overflow property is ignored.

Gilt für: