DataRepeater.SelectionColor 属性
更新:2007 年 11 月
获取或设置首次选定项时 DataRepeater 控件中项标头中显示的颜色。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
Public Property SelectionColor As Color
用法
Dim instance As DataRepeater
Dim value As Color
value = instance.SelectionColor
instance.SelectionColor = value
public Color SelectionColor { get; set; }
public:
property Color SelectionColor {
Color get ();
void set (Color value);
}
public function get SelectionColor () : Color
public function set SelectionColor (value : Color)
属性值
要使用的颜色。其默认值为 Highlight。
备注
仅当某个 DataRepeaterItem 具有焦点时才应用 SelectionColor。 当项中的某个控件具有焦点时,项标头的颜色将与 BackColor 相同。
说明: |
---|
如果将 SelectionColor 设置为 White,当选定项时您将看不到选择符号。 |
示例
下面的示例演示如何更改选择颜色以响应布局更改。
Private Sub DataRepeater1_LayoutStyleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) 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;
}
}
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
另请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间