Propriedade Shape.SelectionColor
Obtém ou define a cor de seleção de uma forma.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (em Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxe
<BrowsableAttribute(True)> _
Public Property SelectionColor As Color
Dim instance As Shape
Dim value As Color
value = instance.SelectionColor
instance.SelectionColor = value
[BrowsableAttribute(true)]
public Color SelectionColor { get; set; }
[BrowsableAttribute(true)]
public:
property Color SelectionColor {
Color get ();
void set (Color value);
}
public function get SelectionColor () : Color
public function set SelectionColor (value : Color)
Valor de propriedade
Tipo: System.Drawing.Color
A Color que representa a cor do retângulo de foco quando uma forma é selecionada em time de execução. O padrão é Highlight.
Comentários
The SelectionColor propriedade pode ser usada para alterar a cor do retângulo de foco é exibido quando um LineShape, OvalShape, ou RectangleShape controle está selecionado em time de execução. Se o CanFocus ou CanSelect as propriedades são conjunto para false, essa propriedade é ignorada.
Exemplos
O exemplo a seguir demonstra como usar o SelectionColor propriedade para alterar a cor do retângulo de foco, dependendo da BackColor propriedade do formulário. Este exemplo requer que você tenha um RectangleShape controle chamado RectangleShape1 em um formulário.
PrivateSub RectangleShape1_GotFocus(ByVal sender AsObject, _
ByVal e As System.EventArgs) 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
EndIfEndSub
privatevoid 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;
}
}
Permissões
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de códigos parcialmente Confiável.
Consulte também
Referência
Namespace Microsoft.VisualBasic.PowerPacks
Outros recursos
Como: Desenhar linhas com o Controlarar de LineShape (Visual Studio)
Como: Desenhar formas com a OvalShape e controles de RectangleShape (Visual Studio)