DataRepeater.SelectionColor 属性

获取或设置在 DataRepeater 控件的项标头会显示的颜色,该项目首次选定时。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
Public Property SelectionColor As Color
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)

属性值

类型:System.Drawing.Color
使用的颜色。默认值为 Highlight

备注

SelectionColor ,仅当 DataRepeaterItem 具有焦点时,适用。 如果在项目的控件具有焦点,项标头的颜色与该 BackColor

备注

如果设置 SelectionColor 到 White,选择符号不可见,在中选择时。

示例

下面的示例演示如何更改选择颜色时响应在布局更改。

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 安全性

请参见

参考

DataRepeater 类

Microsoft.VisualBasic.PowerPacks 命名空间

ItemHeaderVisible

ItemHeaderSize

其他资源

DataRepeater 控件简介 (Visual Studio)

如何:在 DataRepeater 控件中显示项标题 (Visual Studio)