Click here to Skip to main content
Click here to Skip to main content

Vista Style Address Bar for .NET 2.0/WinForms

By , 10 Apr 2010
 
AddressBarExt.zip
AddressBarEx
AddressBarExt.csproj.user
AddressBarExt.suo
bin
Debug
AddressBarExt.exe
AddressBarExt.vshost.exe
Controls
Node
Interface
GRSD_LowCompat.ico
Properties
Settings.settings
AddressBarExt2.zip
AddressBarExt
AddressBarEx_2.0
AddressBarExt_2.0.csproj.user
Backup
AddressBarExt.csproj.user
AddressBarExt.suo
Controls
Node
Interface
GRSD_LowCompat.ico
Properties
Settings.settings
bin
Controls
Node
Interface
obj
Debug
AddressBarExt.Controls.AddressBarExt.resources
AddressBarExt.csproj.GenerateResource.Cache
AddressBarExt.dll
AddressBarExt.exe
AddressBarExt.Form1.resources
AddressBarExt.pdb
AddressBarExt.Properties.Resources.resources
AddressBarExt_2.0.csproj.GenerateResource.Cache
Refactor
TempPE
Properties.Resources.Designer.cs.dll
Release
AddressBarExt.csproj.GenerateResource.Cache
AddressBarExt.exe
TempPE
Properties.Resources.Designer.cs.dll
Properties
Settings.settings
AddressBarExt.suo
DemoApp_2.0
bin
DemoApp_2.0.csproj.user
GRSD_LowCompat.ico
obj
Debug
AddressBarExt.Form1.resources
DemoApp_2._0.Properties.Resources.resources
DemoApp_2.0.csproj.GenerateResource.Cache
DemoApp_2.0.exe
DemoApp_2.0.pdb
Refactor
ResolveAssemblyReference.cache
TempPE
Release
TempPE
Properties
Settings.settings
AddressBarExt2_1.zip
AddressBarExt2_1
AddressBarExt
AddressBarEx_2.0
Controls
Node
Interface
Properties
Settings.settings
AddressBarExt.suo
DemoApp_2.0
GRSD_LowCompat.ico
Properties
Settings.settings
#region Using Statements

#region .NET Namespaces

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

#endregion

#region Custom Namespaces

using AddressBarExt.Controls;
#endregion

#endregion

namespace AddressBarExt
{
    /// <summary>
    /// Basic form that demos the AddressBarExt control.
    /// 
    /// This code is very messy, jsut made for demonstration purposes :)
    /// 
    /// -James Strain
    /// </summary>
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //initialize the bar
            this.AdBar.InitializeRoot(new FileSystemNode());
        }

        private void AdBar_SelectionChange(object sender, NodeChangedArgs nca)
        {
            this.rtb_path.Text = (String)nca.OUniqueID;
        }

        private void btn_c_Click(object sender, EventArgs e)
        {
            this.AdBar.InitializeRoot(new FileSystemNode("C:\\",null));
            this.rtb_path.Text = "C:\\";
        }

        private void btn_d_Click(object sender, EventArgs e)
        {
            //get the root node
            IAddressNode root = this.AdBar.RootNode;

            //search the child nodes, non-recursivly
            this.AdBar.CurrentNode = root.GetChild(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), false);
        }

        private void AdBar_NodeDoubleClick(object sender, NodeChangedArgs nca)
        {
            this.rtb_path.Text = (String)nca.OUniqueID;


            System.Diagnostics.ProcessStartInfo exploreTest = new System.Diagnostics.ProcessStartInfo();
            exploreTest.FileName = "explorer.exe";
            exploreTest.Arguments = (String)nca.OUniqueID;
            System.Diagnostics.Process.Start(exploreTest);

        }

        private void btn_fake_Click(object sender, EventArgs e)
        {
            this.AdBar.CurrentNode = new FileSystemNode("D:\\", null);
        }

        private void AdBar_DoubleClick(object sender, EventArgs e)
        {
            MessageBox.Show("AIDS!");
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of use and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

About the Author

jwraith
Software Developer
United Kingdom United Kingdom
Member
A graduate of the University of Dundee, and an ex-Microsoft UK Support Engineer currently happily employed at Codemasters, Southam.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 10 Apr 2010
Article Copyright 2009 by jwraith
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid