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.
Unfortunately, activation email could not send to your email. Please try again.

Cell Border Color of GridDataBoundGrid

Thread ID:





129743 Mar 31,2017 10:21 AM Apr 3,2017 11:52 PM Windows Forms 3
Tags: GridDataBoundGrid(Classic)
Asked On March 31, 2017 10:21 AM

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

Arulpriya Ramalingam [Syncfusion]
Replied On April 3, 2017 05:07 AM

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 


Replied On April 3, 2017 09:23 AM

Thanks, It works perfectly. 

Arulpriya Ramalingam [Syncfusion]
Replied On April 3, 2017 11:52 PM

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.    


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.