We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cell Border Color of GridDataBoundGrid

I'm using DrawCellFrameAppearance event in GridDataBoundGrid to customize the appearance of my grid but when any cell is selected, the border of the cell getting black and I could not force it to not change the border color. how can I do it?

 Private Sub gdbTelephone_DrawCellFrameAppearance(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridDrawCellBackgroundEventArgs) Handles gdbTelephone.DrawCellFrameAppearance
        Dim rowIndex As Integer = e.Style.CellIdentity.RowIndex
        Dim colIndex As Integer = e.Style.CellIdentity.ColIndex
        If rowIndex > 0 AndAlso colIndex <> 3 Then
            Dim brush As Brush
            Dim g As Graphics = e.Graphics
            brush = New System.Drawing.Drawing2D.LinearGradientBrush(e.TargetBounds, Color.FromArgb(209, 211, 212), Color.FromArgb(209, 211, 212), 0.0F)
            Dim rect As Rectangle = e.TargetBounds
            rect.Inflate(-2, -2)
            Dim rects As Rectangle() = New Rectangle() {New Rectangle(rect.X, rect.Y, rect.Width, 1), New Rectangle(rect.X, rect.Y, 1, rect.Height), New Rectangle(rect.Right - 1, rect.Y, 1, rect.Height), New Rectangle(rect.X, rect.Bottom - 1, rect.Width, 1)}
            Dim blueBrush As New SolidBrush(Color.White)
            g.FillRectangle(blueBrush, rect)
            g.FillRectangles(brush, rects)
            e.Cancel = True
        End If   
    End Sub



3 Replies

AR Arulpriya Ramalingam Syncfusion Team April 3, 2017 09:07 AM UTC

Hi Xetod, 

Thanks for your interest in Syncfusion products. 

By default, the border will be drawn for a cell when the cell is focused. The border can be hidden by using ShowCurrentCellBorderBehavior property. Please make use of below code and sample, 

Code snippet 

'To hide the border  
gridDataBoundGrid1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways 




Regards, 
Arulpriya 



XE xetod April 3, 2017 01:23 PM UTC

Thanks, It works perfectly. 


AR Arulpriya Ramalingam Syncfusion Team April 4, 2017 03:52 AM UTC

Hi Xetod,   

We are glad to hear that the provided solution is resolved your scenario.   

Please let us know if you need any further assistance.    
   
Regards,   
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon