ToolStripDropDown.DefaultDropDownDirection Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá nebo nastaví směr, ve kterém ToolStripDropDown je zobrazen vzhledem k ToolStrip.
public:
virtual property System::Windows::Forms::ToolStripDropDownDirection DefaultDropDownDirection { System::Windows::Forms::ToolStripDropDownDirection get(); void set(System::Windows::Forms::ToolStripDropDownDirection value); };
public override System.Windows.Forms.ToolStripDropDownDirection DefaultDropDownDirection { get; set; }
member this.DefaultDropDownDirection : System.Windows.Forms.ToolStripDropDownDirection with get, set
Public Overrides Property DefaultDropDownDirection As ToolStripDropDownDirection
Hodnota vlastnosti
Jedna z ToolStripDropDownDirection hodnot.
Příklady
Následující příklad kódu ukazuje, jak přiřadit DefaultDropDownDirection vlastnost určenou nastavením přepínačů.
// The following methods handle the CheckChanged event
// for all the radio buttons. Each method calls a utility
// method to set the ToolStripDropDownDirection appropriately.
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.AboveLeft);
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.AboveRight);
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.BelowLeft);
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.BelowRight);
}
private void radioButton5_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.Default);
}
private void radioButton6_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.Left);
}
private void radioButton7_CheckedChanged(object sender, EventArgs e)
{
this.HandleRadioButton(sender, ToolStripDropDownDirection.Right);
}
// This utility method sets the DefaultDropDownDirection property.
private void HandleRadioButton(object sender, ToolStripDropDownDirection direction)
{
RadioButton rb = sender as RadioButton;
if (rb != null)
{
if (rb.Checked)
{
this.dropDownDirection = direction;
this.contextMenuStrip1.DefaultDropDownDirection = direction;
}
}
}
' The following methods handle the CheckChanged event
' for all the radio buttons. Each method calls a utility
' method to set the ToolStripDropDownDirection appropriately.
Private Sub radioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton1.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.AboveLeft)
End Sub
Private Sub radioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton2.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.AboveRight)
End Sub
Private Sub radioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton3.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.BelowLeft)
End Sub
Private Sub radioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton4.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.BelowRight)
End Sub
Private Sub radioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton5.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.Default)
End Sub
Private Sub radioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton6.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.Left)
End Sub
Private Sub radioButton7_CheckedChanged(sender As Object, e As EventArgs) Handles radioButton7.CheckedChanged
Me.HandleRadioButton(sender, ToolStripDropDownDirection.Right)
End Sub
' This utility method sets the DefaultDropDownDirection property.
Private Sub HandleRadioButton(sender As Object, direction As ToolStripDropDownDirection)
Dim rb As RadioButton = CType(sender, RadioButton)
If rb IsNot Nothing Then
If rb.Checked Then
Me.dropDownDirection = direction
Me.contextMenuStrip1.DefaultDropDownDirection = direction
End If
End If
End Sub
Platí pro
Spolupracujte s námi na GitHubu
Zdroj tohoto obsahu najdete na GitHubu, kde můžete také vytvářet a kontrolovat problémy a žádosti o přijetí změn. Další informace najdete v našem průvodci pro přispěvatele.