كود :
Public Sub SettingAnydgv(ByVal dgv As DataGridView)
dgv.AllowUserToAddRows = False
dgv.AllowUserToDeleteRows = False
dgv.AllowUserToOrderColumns = True
dgv.AllowUserToResizeColumns = False
dgv.AllowUserToResizeRows = False
dgv.RightToLeft = RightToLeft.Yes
dgv.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
dgv.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.Color.Khaki
dgv.BackgroundColor = System.Drawing.Color.Azure
dgv.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Sunken
dgv.ColumnHeadersDefaultCellStyle.Font = New System.Drawing.Font("Tajawal", 10.0!, System.Drawing.FontStyle.Bold)
dgv.ColumnHeadersDefaultCellStyle.SelectionBackColor = System.Drawing.SystemColors.Highlight
dgv.ColumnHeadersDefaultCellStyle.SelectionForeColor = System.Drawing.SystemColors.HighlightText
dgv.ColumnHeadersDefaultCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
dgv.ColumnHeadersDefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
dgv.Cursor = System.Windows.Forms.Cursors.Hand
dgv.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
dgv.DefaultCellStyle.BackColor = System.Drawing.SystemColors.Control
dgv.DefaultCellStyle.Font = New System.Drawing.Font("Tajawal", 10.0!, System.Drawing.FontStyle.Bold)
dgv.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.DarkCyan
dgv.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Yellow
dgv.DefaultCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
dgv.GridColor = System.Drawing.Color.Red
dgv.RowsDefaultCellStyle.BackColor = System.Drawing.Color.Beige
dgv.MultiSelect = False
dgv.ColumnHeadersHeight = 32
'Height Rows
Dim RH As Integer = dgv.Rows.Count - 1
Dim ii As Integer
If dgv IsNot Nothing Then
For ii = 0 To RH
dgv.Rows.Item(ii).Height = 28
Next
End If
End Sub