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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell Border Color of GridDataBoundGrid

Thread ID:





129743 Mar 31,2017 02:21 PM UTC Apr 4,2017 03:52 AM UTC WinForms 3
Tags: GridDataBoundGrid(Classic)
Asked On March 31, 2017 02:21 PM UTC

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 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 


Replied On April 3, 2017 01:23 PM UTC

Thanks, It works perfectly. 

Arulpriya Ramalingam [Syncfusion]
Replied On 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.    


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon