Cara menambahkan nomor pada DatagridView :
Kode Program VB.Net :
Private Sub DataGridViewRowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs)
Dim dg As DataGridView = DirectCast(sender, DataGridView) Dim rowNumber As String = (e.RowIndex + 1).ToString() While rowNumber.Length < dg.RowCount.ToString().Length rowNumber = "0" & rowNumber End While Dim size As SizeF = e.Graphics.MeasureString(rowNumber, Me.Font) If dg.RowHeadersWidth < CInt(size.Width + 20) Then dg.RowHeadersWidth = CInt(size.Width + 20) End If Dim b As Brush = SystemBrushes.ControlText e.Graphics.DrawString(rowNumber, dg.Font, b, e.RowBounds.Location.X + 15, _
e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2)) End Sub
1 komentar:
Thank you atas scriptnya gan
Posting Komentar