Windows 7 style Address bar control implementation

Source: Internet
Author: User
Tags unique id

Introduced

From the Vista, the Address bar has a great change, do not know what you feel, I feel very convenient, but also compatible with the function before, is a very good innovation. However, Microsoft is not going to make this cool feature available to the vast majority of developers.

This article provides a simple address bar implementation that uses. NET 2.0 and VS2008. It is implemented on the basis of a simple tree traversal, and applies to various cascading data.

The demo provides a very simple example that allows you to browse the file system. Here is a demonstration of how it works.

Using code

The easiest way to understand the implementation is to download the source code directly, then open the game to see ~

Under Design-time, drag the address Bar control into the form, and then add the following line of code to the constructor:

//Initialize the bar with a root node type.this.AdBar.InitializeRoot(newFileSystemNode());

You only need to pass in a root node, and the root node will provide information for control. Filesystemnode contains the first logical disk information after installation of the Windows system. To implement the Iaddressnode type, there are three important methods that you need to implement yourself:

UpdateNode() - Used to update the node itself forany changes (e.g. inthe FileSystemNode it checks for child folder changes and folder name changes)GetChild() - Searches fora given child node based ona unique ID (A Unique ID being whatever you define it as. In FileSystemNode, we use an absolute path fora folder asthe unique ID).Clone() - Clones a given node asa separate value copy (rather than just byreference).

Windows 7 style Address bar control implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.