Shape.SelectionColor Property
Gets or sets the selection color of a shape.
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)
Property Value
Type: System.Drawing.Color
A Color that represents the color of the focus rectangle when a shape is selected at run time. The default is Highlight.
Remarks
The SelectionColor property can be used to change the color of the focus rectangle that is displayed when a LineShape, OvalShape, or RectangleShape control is selected at run time. If the CanFocus or CanSelect properties are set to false, this property is ignored.
Examples
The following example demonstrates how to use the SelectionColor property to change the color of the focus rectangle depending on the BackColor property of the form. This example requires that you have a RectangleShape control named RectangleShape1 on a form.
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)