本文整理汇总了VB.NET中System.Windows.Forms.DataGridTableStyle.ForeColor属性的典型用法代码示例。如果您正苦于以下问题:VB.NET DataGridTableStyle.ForeColor属性的具体用法?VB.NET DataGridTableStyle.ForeColor怎么用?VB.NET DataGridTableStyle.ForeColor使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.DataGridTableStyle 的用法示例。
在下文中一共展示了DataGridTableStyle.ForeColor属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: DataSet
Private Sub Create_Table()
' Create a DataSet.
myDataSet = New DataSet("myDataSet")
' Create DataTable.
Dim myCustomerTable As New DataTable("Customers")
' Create two columns, and add to the table.
Dim CustID As New DataColumn("CustID", GetType(Integer))
Dim CustName As New DataColumn("CustName")
myCustomerTable.Columns.Add(CustID)
myCustomerTable.Columns.Add(CustName)
Dim newRow1 As DataRow
' Create three customers in the Customers Table.
Dim i As Integer
For i = 1 To 2
newRow1 = myCustomerTable.NewRow()
newRow1("custID") = i
' Add row to the Customers table.
myCustomerTable.Rows.Add(newRow1)
Next i
' Give each customer a distinct name.
myCustomerTable.Rows(0)("custName") = "Alpha"
myCustomerTable.Rows(1)("custName") = "Beta"
' Add table to DataSet.
myDataSet.Tables.Add(myCustomerTable)
dataGrid1.SetDataBinding(myDataSet, "Customers")
myTableStyle = New DataGridTableStyle()
myTableStyle.MappingName = "Customers"
myTableStyle.ForeColor = Color.DarkMagenta
dataGrid1.TableStyles.Add(myTableStyle)
End Sub
' Set table's forecolor.
Private Sub OnForeColor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
dataGrid1.TableStyles.Clear()
Select Case myComboBox.SelectedItem.ToString()
Case "Green"
myTableStyle.ForeColor = Color.Green
Case "Red"
myTableStyle.ForeColor = Color.Red
Case "Violet"
myTableStyle.ForeColor = Color.Violet
End Select
dataGrid1.TableStyles.Add(myTableStyle)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:44,代码来源:DataGridTableStyle.ForeColor
注:本文中的System.Windows.Forms.DataGridTableStyle.ForeColor属性示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论