Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim table As New DataTable table.Columns.Add("科目", GetType(String)) table.Columns.Add("点数", GetType(Integer)) table.Rows.Add("国語", 80) table.Rows.Add("数学", 30) table.Rows.Add("英語", 50) DataGridView1.DataSource = table End Sub Private Sub DataGridView1_CellPainting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting If e.ColumnIndex = 1 AndAlso e.RowIndex >= 0 Then Dim BarRect As Rectangle = e.CellBounds BarRect.Width = BarRect.Width * (e.Value / 100) e.Graphics.FillRectangle(Brushes.White, e.CellBounds) e.Graphics.FillRectangle(Brushes.Red, BarRect) e.Graphics.DrawRectangle(Pens.Black, e.CellBounds) e.Handled = True End If End Sub