在datagridview

时间:2018-01-18 12:08:48

标签: vb.net

我正在开发一个Windows应用程序(vb.net,vs 2012,metro ui),但仍然坚持这一点。

在datagridview中添加列 - >运行时间 在datagridview中添加按钮 - >运行时间 使用metro UI框架,表单布局看起来不错,但是如何在datagridview中设置按钮的背景图像(method-gv_btn)?

Private Sub load_gv_client()
    DataGridView1.ColumnCount = 2
    DataGridView1.Columns(0).Name = "Name"
    DataGridView1.Columns(1).Name = "Company"
    DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
End Sub

Private Sub load_client()
    'code skipped- fetching data from database
    adapter.Fill(dt)
    For Each row In dt.Rows
        populate_client(row(0), row(1))
    Next
End Sub

Private Sub populate_client(Name As String, Company As String)
    Dim row As String() = New String() {Name, Company}
    DataGridView1.Rows.Add(row)
End Sub

Private Sub gv_btn()
    Dim btn As New DataGridViewButtonColumn
    DataGridView1.Columns.Add(btn)
    btn.HeaderText = "Edit"
    btn.Text = "Edit"
    btn.Name = "btn"
    btn.UseColumnTextForButtonValue = True        
End Sub

0 个答案:

没有答案