DataGrid.BackgroundColor 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置网格中非行区域的颜色。
public:
property System::Drawing::Color BackgroundColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color BackgroundColor { get; set; }
member this.BackgroundColor : System.Drawing.Color with get, set
Public Property BackgroundColor As Color
属性值
一个 Color,它代表网格的背景的颜色。 默认是 AppWorkspace 颜色。
示例
下面的代码示例设置 BackColor、 和 BackgroundColor 属性。
private:
void SetGridColors()
{
dataGrid1->BackColor = System::Drawing::Color::Red;
dataGrid1->AlternatingBackColor = System::Drawing::Color::AliceBlue;
dataGrid1->BackgroundColor = System::Drawing::Color::Yellow;
}
private void SetGridColors(){
dataGrid1.BackColor=System.Drawing.Color.Red;
dataGrid1.AlternatingBackColor= System.Drawing.Color.AliceBlue;
dataGrid1.BackgroundColor=System.Drawing.Color.Yellow;
}
Private Sub SetGridColors()
dataGrid1.BackColor = System.Drawing.Color.Red
dataGrid1.AlternatingBackColor = System.Drawing.Color.AliceBlue
dataGrid1.BackgroundColor = System.Drawing.Color.Yellow
End Sub
注解
确定 BackgroundColor 网格的非行区域的颜色,仅当 未显示 System.Windows.Forms.DataGrid表时,或者网格滚动到底部,或者网格中仅包含几行时,才可见。