共用方式為


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)

HOW TO:在 DataRepeater 控制項中顯示項目標題 (Visual Studio)