Freigeben über


Shape.SelectionColor-Eigenschaft

Ruft die Auswahlfarbe einer Form ab oder legt diese fest.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property SelectionColor As Color
[BrowsableAttribute(true)]
public Color SelectionColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color SelectionColor {
    Color get ();
    void set (Color value);
}
[<BrowsableAttribute(true)>]
member SelectionColor : Color with get, set
function get SelectionColor () : Color 
function set SelectionColor (value : Color)

Eigenschaftswert

Typ: Color
Ein Color , das die Farbe des Fokusrechtecks darstellt, wenn ein Shape zur Laufzeit ausgewählt wird.Die Standardeinstellung ist Highlight.

Hinweise

Die SelectionColor -Eigenschaft kann verwendet werden, um die Farbe des Fokusrechtecks zu ändern, ist angezeigt wird, wenn ein LineShape, OvalShape, oder RectangleShape Steuerelement zur Laufzeit ausgewählt ist. Wenn die CanFocus oder CanSelect Eigenschaften werden festgelegt, um false, wird diese Eigenschaft ignoriert.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie Sie die SelectionColor -Eigenschaft so ändern Sie die Farbe des Fokusrechtecks je nach der BackColor -Eigenschaft des Formulars. In diesem Beispiel benötigen Sie ein RectangleShape -Steuerelement namens RectangleShape1 in einem Formular.

Private Sub RectangleShape1_GotFocus() Handles RectangleShape1.GotFocus
    ' If SelectionColor is the same as the form's BackColor. 
    If RectangleShape1.SelectionColor = Me.BackColor Then 
        ' Change the SelectionColor.
        RectangleShape1.SelectionColor = Color.Red
    Else 
        ' Use the default SelectionColor.
        RectangleShape1.SelectionColor = SystemColors.Highlight
    End If 
End Sub
private void rectangleShape1_GotFocus(object sender, System.EventArgs e)
{
    // If SelectionColor is the same as the form's BackColor. 
    if (rectangleShape1.SelectionColor == this.BackColor)
    // Change the SelectionColor.
    {
        rectangleShape1.SelectionColor = Color.Red;
    }
    else
    {
        // Use the default SelectionColor.
        rectangleShape1.SelectionColor = SystemColors.Highlight;
    }
}

.NET Framework-Sicherheit

Siehe auch

Referenz

Shape Klasse

Microsoft.VisualBasic.PowerPacks-Namespace

Weitere Ressourcen

Gewusst wie: Zeichnen von Linien mit dem LineShape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Formen mit dem OvalShape-Steuerelement und dem RectangleShape-Steuerelement (Visual Studio)

Einführung in das Line-Steuerelement und das Shape-Steuerelement (Visual Studio)