- 博客(1)
- 资源 (4)
- 收藏
- 关注
转载 c++ STL 基本容器理解(内含代码段)
C++中有两种类型的容器:顺序容器和关联容器。顺序容器主要有vector、list、deque等。其中vector表示一段连续的内存,基于数组实现,list表示非连续的内存,基于链表实现,deque与vector类似,但是对首元素提供插入和删除的双向支持。关联容器主要有map和set。map是key-value形式,set是单值。map和set只能存放唯一的key,multimap和multise
2017-05-18 16:16:54 507
资源管理器
//用户登录
FrmLogin login = new FrmLogin();
if (login.ShowDialog() == DialogResult.OK)
{
//MessageBox.Show("Welcome");
//this.Hide();
}
else
{
Application.Exit();
}
this.tsbAddress.Size = new Size(this.toolStrip1.Width - 130, toolStrip2.Height);
TreeNode rootNode = treeView1.Nodes[0];
rootNode.Expand();
TreeNode ndMyComputer = null;
TreeNode ndMyDocuments = null;
foreach (TreeNode nd in rootNode.Nodes)
{
if (nd.Name == "ndMyComputer")
{
ndMyComputer = nd;
}
if (nd.Name == "ndMyDocuments")
{
ndMyDocuments = nd;
}
}
//展开我的电脑
DriveInfo[] drivers = DriveInfo.GetDrives();
foreach (DriveInfo drive in drivers)
{
TreeNode node = new TreeNode();
node.Text = drive.Name;
if (drive.DriveType == DriveType.Fixed)
{
node.ImageKey = "hdd.ico";
node.SelectedImageKey = "hdd.ico";
node.Tag = drive.RootDirectory.FullName;
}
ndMyComputer.Nodes.Add(node);
}
//展开我的文档
string strMyDocumentFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
DirectoryInfo myDocument = new DirectoryInfo(strMyDocumentFolderPath);
DirectoryInfo[] folders = myDocument.GetDirectories();
foreach (DirectoryInfo di in folders)
{
TreeNode node = new TreeNode(di.Name);
node.Tag = di.FullName;
node.ImageKey = "folder.ico";
node.SelectedImageKey = "folder.ico";
ndMyDocuments.Nodes.Add(node);
}
}
2015-05-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人