Click here to Skip to main content
Licence CPOL
First Posted 8 Feb 2008
Views 24,873
Downloads 862
Bookmarked 38 times

Windows Vista Treeview

By | 12 Feb 2008 | Article
A custom made TreeView with Windows Vista look.

Vista_TreeView.jpg

Introduction

This is a custom TreeView control which provides a Windows Vista look.

Background

The code is a combination of three different codes made by José Manuel Menéndez Poo, Xasthom, and Stephen J Whiteley. As most of the code is made by Stephen, his copyright messages have been left.

This code is a part of the SQLmail.org project, an Open Source project whose goal is to make a MySQL based mail client. All messages should be stored in a SQL database which will provide extremely fast search. As I would like to have Windows Vista look for the whole program, almost all controls are customized. In the SQLmail.org project, you can find a Vista customized button, a radio button, a checkbox, a toolstrip, and a datagrid, and the way to use them.

Using the Code

It is very easy to use this control. Download the class from the link at the top of the page and import it in your project. Build your project, and you will find it as a new control in the Toolbox.

You can use a custom node like this:

Dim NewNode As New WindowsVistaNode
NewNode.Name = "myname"
NewNode.Text = "text"
' If you need an icon next to the node, add an ImageList
' on the form, import images in it (Images, Collection),
' on the treeview select the added ImageList in the ImageList property
NewNode.ImageKey = "image.gif" ' name of the image in the ImageList collection
NewNode.SelectedImageKey = "image.gif"
' name of the image which will be drawn when the node is selected, 
' for example, a closed folder for default and an open one for selected

'
' If you want to change a font on the specific node
NewNode.Font = New Font(TreeView1.Font.FontFamily, _
                        TreeView1.Font.Size, FontStyle.Bold)
' Title property is a custom property which allowes you
' to have different sections in a treeview.
' Title node cannot be selected, cannot be closed (always expanded),
' cannot be highlighted when the mouse is hovering
' and the text is always left alligned
NewNode.Title = True
NewNode.Text = UCase(NewNode.Text) ' use it for title nodes
'
Folder_Tree.Nodes.Add(NewNode)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

virtual.aussie

Software Developer (Senior)

Croatia Croatia

Member

28 years of experience with computers, 8 with BASIC and Z80 assemblers (ZX Spectrum), 6 years VB, 6 years MS Office Macros, 1 year C#, 10 years MS SQL, 1 year MySQL, 5 years ASP and 3 years PHP. Playing with javascript in last couple of months.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questiondose it have C++ version ? Pinmemberhaily_lee22:51 2 Nov '10  
GeneralIf anyone wants, here is a C# version PinmemberNadeem031916:51 27 Sep '09  
GeneralRe: If anyone wants, here is a C# version PinmemberMember 432946921:15 18 Jan '10  
GeneralYou fixed the paint issue - well done! PinmemberScott Kane2:54 29 Jan '09  
GeneralRe: You fixed the paint issue - well done! PinmemberMember 432946912:49 19 Jan '10  
GeneralMy vote of 1 PinmemberMember 46377018:20 1 Dec '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 12 Feb 2008
Article Copyright 2008 by virtual.aussie
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid