Compartir a través de


Shape.SelectionColor (Propiedad)

Obtiene o establece el color de selección de una forma.

Espacio de nombres:  Microsoft.VisualBasic.PowerPacks
Ensamblado:  Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxis

'Declaración
<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)

Valor de propiedad

Tipo: Color
Color que representa el color del rectángulo de foco cuando una forma se selecciona en tiempo de ejecución.De manera predeterminada, es Highlight.

Comentarios

El SelectionColor propiedad puede utilizarse para cambiar el color del rectángulo de foco que se muestra cuando un LineShape, OvalShape, o RectangleShape se selecciona el control en tiempo de ejecución. Si el CanFocus o CanSelect propiedades están establecidas en false, esta propiedad se omite.

Ejemplos

En el ejemplo siguiente se muestra cómo utilizar el SelectionColor propiedad para cambiar el color del rectángulo de foco en función de la BackColor propiedad del formulario. Este ejemplo requiere que haya un RectangleShape control denominado RectangleShape1 en un formulario.

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;
    }
}

Seguridad de .NET Framework

Vea también

Referencia

Shape Clase

Microsoft.VisualBasic.PowerPacks (Espacio de nombres)

Otros recursos

Cómo: Dibujar líneas con el control LineShape (Visual Studio)

Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)

Introducción a los controles de líneas y formas (Visual Studio)