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

Change Multi-column Treeview cell border and alternate row color

Thread ID:





128127 Jan 4,2017 08:23 AM UTC Jan 9,2017 03:51 AM UTC WinForms 3
Tags: MultiColumnTreeView
Asked On January 4, 2017 08:23 AM UTC

I am using Multi-column treeview. I would like to change my border like spread sheet (continuous solid lines). I also want to set alternate row color. I am using VB.NET 2010.

What I am getting now is below:

What I like is below

Please help me solve this issue. Thank you.

Amirtharaj VK

Senthil Kumaran Rajan [Syncfusion]
Replied On January 5, 2017 11:06 AM UTC

Hi Amirtharaj, 
Thanks for contacting Syncfusion Support. 
We can draw the border for the Nodes in MultiColumnTreeViewAdv, by handling the BeforePaint event. And the border of the SubItems can be customized by using the properties named BorderColor, BorderSides, BorderSingle and BorderStyle. Please make use of the below code example. 
Code Example[VB]: 
'To Paint border for nodes 
Private Sub multiColumnTreeView1_BeforeNodePaint(ByVal sender As Object, ByVal e As TreeNodeAdvPaintEventArgs) 
e.Graphics.DrawLine(Pens.Red, New Point(0, e.Node.Bounds.Y), New Point(Me.multiColumnTreeView1.Width,e.Node.Bounds.Y)) 
End Sub 
'To Paint border for sub nodes. 
For i As Integer = 0 To Me.multiColumnTreeView1.Nodes.Count - 1 
  For j As Integer = 1 To Me.multiColumnTreeView1.Nodes(i).SubItems.Count - 1 
    Me.multiColumnTreeView1.Nodes(i).SubItems(j).BorderColor = Color.Red 
    Me.multiColumnTreeView1.Nodes(i).SubItems(j).BorderSingle =        System.Windows.Forms.ButtonBorderStyle.Solid 
    Me.multiColumnTreeView1.Nodes(i).SubItems(j).BorderStyle = BorderStyle.FixedSingle 
    Me.multiColumnTreeView1.Nodes(i).SubItems(j).BorderSides = Border3DSide.Top 
  Next j 
Next i 
'Alternate row color. 
For i As Integer = 0 To Me.multiColumnTreeView1.Nodes.Count - 1 
If i Mod 2 <> 0 Then 
Me.multiColumnTreeView1.Nodes(i).Background = New Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.None, System.Drawing.SystemColors.WindowText, System.Drawing.Color.FromArgb((CInt(Fix((CByte(0))))), (CInt(Fix((CByte(192))))), (CInt(Fix((CByte(0))))))) 
For j As Integer = 1 To Me.multiColumnTreeView1.Nodes(i).SubItems.Count - 1 
Me.multiColumnTreeView1.Nodes(i).SubItems(j).Background = New Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.None, System.Drawing.SystemColors.WindowText, System.Drawing.Color.FromArgb((CInt(Fix((CByte(0))))), (CInt(Fix((CByte(192))))), (CInt(Fix((CByte(0))))))) 
Next j 
End If 
Next i 
We have prepared the sample for your reference and this can be downloaded from the below location. 
Also, refer the below screenshot for further reference. 

Replied On January 7, 2017 04:25 AM UTC

Hi Senthil:

Thanks for your help. I will try and give the feedback.

Amirtharaj VK

Senthil Kumaran Rajan [Syncfusion]
Replied On January 9, 2017 03:51 AM UTC

Hi Amirtharaj,

Thank you for your update.

We will wait until we hear from you.



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