次の方法で共有


DataRepeater.SelectionColor Property

Gets or sets the color that is displayed in the item header of a DataRepeater control when an item is first selected.

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

Syntax

'宣言
Public Property SelectionColor As Color
    Get
    Set
public Color SelectionColor { get; set; }
public:
property Color SelectionColor {
    Color get ();
    void set (Color value);
}
member SelectionColor : Color with get, set
function get SelectionColor () : Color
function set SelectionColor (value : Color)

Property Value

Type: System.Drawing.Color
The color to use. The default is Highlight.

Remarks

The SelectionColor is applied only when a DataRepeaterItem has focus. When a control in the item has focus, the item header color will be the same as the BackColor.

注意

If you set the SelectionColor to White, the selection symbol is not visible when the item is selected.

Examples

The following example demonstrates how to change the selection color in response to a change in layout.

Private Sub DataRepeater1_LayoutStyleChanged(
    ) Handles DataRepeater1.LayoutStyleChanged

    ' Set the SelectionColor based on orientation.
    If DataRepeater1.LayoutStyle = 
       PowerPacks.DataRepeaterLayoutStyles.Vertical Then

        DataRepeater1.SelectionColor = Drawing.Color.Blue
    Else
        DataRepeater1.SelectionColor = Drawing.Color.Red
    End If
End Sub
private void dataRepeater1_LayoutStyleChanged(object sender, System.EventArgs e)
{
    // Set the SelectionColor based on orientation.
    if (dataRepeater1.LayoutStyle == DataRepeaterLayoutStyles.Vertical)
    {
        dataRepeater1.SelectionColor = System.Drawing.Color.Blue;
    }
    else
    {
        dataRepeater1.SelectionColor = System.Drawing.Color.Red;
    }
}

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

ItemHeaderVisible

ItemHeaderSize

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

How to: Display Item Headers in a DataRepeater Control (Visual Studio)