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.

Change Multi-column Treeview cell border and alternate row color

Thread ID:

Created:

Updated:

Platform:

Replies:

128127 Jan 4,2017 03:23 AM Jan 8,2017 10:51 PM Windows Forms 3
loading
Tags: MultiColumnTreeView
Amirtharaj
Asked On January 4, 2017 03:23 AM

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.

Sincerely
Amirtharaj VK

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

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. 
 
 
 
Regards, 
Senthil 


Amirtharaj
Replied On January 6, 2017 11:25 PM

Hi Senthil:

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

Sincerely
Amirtharaj VK

Senthil Kumaran Rajan [Syncfusion]
Replied On January 8, 2017 10:51 PM

Hi Amirtharaj,

Thank you for your update.

We will wait until we hear from you.

Regards,
Senthil.

CONFIRMATION

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.

;