Friday, November 4, 2016

DevExpress-Gridview(RowHeader Number)

    Private Sub GridView1_CustomDrawRowIndicator1(sender As Object, e As RowIndicatorCustomDrawEventArgs) Handles GridView1.CustomDrawRowIndicator
        If e.Info.IsRowIndicator AndAlso e.RowHandle >= 0 Then
            e.Info.DisplayText = e.RowHandle + 1 '.ToString
            Dim tSizeF As SizeF = e.Graphics.MeasureString(e.Info.DisplayText, e.Appearance.Font)
            Dim requiredWidth As Integer = Convert.ToInt32(tSizeF.Width) + 16
            Me.BeginInvoke(CType(Function() AnonymousMethod1(requiredWidth), MethodInvoker))
        End If
    End Sub
'----------------------------------
Private Function AnonymousMethod1(ByVal requiredWidth As Integer) As Boolean
        GridView1.IndicatorWidth = If(GridView1.IndicatorWidth < requiredWidth, requiredWidth, GridView1.IndicatorWidth)
        Return True
 End Function


DevExpress-Gridview(RowColor)

Imports DevExpress.XtraGrid.Views.Grid

Private Sub GridView1_RowStyle(ByVal sender As Object, _
ByVal e As DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs) Handles GridView1.RowStyle
   Dim View As GridView = sender
   If (e.RowHandle >= 0) Then
      Dim category As String = View.GetRowCellDisplayText(e.RowHandle, View.Columns("Category"))
      If category = "Beverages" Then
         e.Appearance.BackColor = Color.Salmon
         e.Appearance.BackColor2 = Color.SeaShell
      End If
   End If
End Sub




file://C:\Users\chatchda\AppData\Local\Temp\ct_tmp/1.png