Windows 7样式地址栏(Address Bar)控件实现
来源:互联网 发布:淘宝运营组织架构 编辑:程序博客网 时间:2024/06/11 01:16
介绍
从Vista开始,地址栏就有了很大的改变,不知道大家有什么感觉,笔者觉得很方便,同时又兼容之前的功能,是个很不错的创新。不过,微软并不打算把这一很酷的功能提供给广大的开发人员。
本文提供了一个简单的Address Bar实现,使用.NET 2.0和VS2008. 它是基于一个简单的树型遍历实现的,同时适用于各种级联数据。
Demo中提供的是一个非常简单的示例,可以浏览文件系统。这里这是展示它是如何工作的。
使用代码
了解实现最简单的办法就是直接下载源代码,然后打开玩玩看~
在Design-Time下将Address Bar Control拖入Form,然后再构造器中加入下面一行代码:
//Initialize the bar with a root node type.this.AdBar.InitializeRoot(new FileSystemNode());
你只需要传入一个根节点,然后根节点就会为control提供信息。FileSystemNode包含Windows系统安装后的第一个逻辑盘信息。
要实现IAddressNode类型,有如下三个重要的方法需要自己实现:
UpdateNode() - Used to update the node itself for any changes (e.g. in the FileSystemNode it checks for child folder changes and folder name changes)GetChild() - Searches for a given child node based on a unique ID (A Unique ID being whatever you define it as. In FileSystemNode, we use an absolute path for a folder as the unique ID).Clone() - Clones a given node as a separate value copy (rather than just by reference).
总结
示例很简单,相对来说也是轻量级的实现。如果想用它操作输了FileSystemNode以外的数据,你只需要实现IAddressNode接口,任何级联结构(hierarchical structure)的数据都可以用它来呈现。
许可证
本文以及示例代码文件遵循The Code Project Open License(CPOL)。
源码下载
附件:AddressBarExt2_1.zip
英文链接:Vista Style Address Bar for .NET 2.0/WinForms
- Windows 7样式地址栏(Address Bar)控件实现
- Run JS in Address Bar
- 一起学Windows phone 7开发(一.Application Bar)
- Windows phone 7中的图像控件、资源和样式
- Windows Phone开发(16):样式和控件模板
- Windows Phone开发(16):样式和控件模板
- 设置uitab bar 样式
- Action Bar的样式
- iOS之常用栏控件(bar)
- 代码 实现UIDatePicker控件 和 Tab Bar 视图切换
- Windows常见窗口样式和控件风格
- Windows常见窗口样式和控件风格
- Windows常见窗口样式和控件风
- Windows 窗体 DataGridView 控件中的单元格样式
- Windows常见窗口样式和控件风格
- Windows常见窗口样式和控件风格
- Windows常见窗口样式和控件风格
- Windows常见窗口样式和控件风格
- 理解ArcSDE和OracleSpatial一点诀窍
- centOS 下 sendmail邮件服务器搭载smtp和pop3认证的配置方法
- 兄弟连Linux在线课堂:第8讲 Linux进程管理
- 兄弟连Linux在线课堂:第8讲 Linux进程管理
- JS如何实现在一个页面停留1分钟跳转另外一个页面?
- Windows 7样式地址栏(Address Bar)控件实现
- flash 地址
- 连接数据库
- 简单的验证码实现
- 交叉编译Pjsip for arm linux
- 系统恢复的,我也不知道什么东西
- java基础
- pthreads programming Chapter 3: Synchronizing Pthreads 翻译
- 课程设计