自制Windows Mobile的文件浏览器

使用Windows 自带的文件浏览器只能察看My Doucument中间的文件,这叫人非常不爽。
于是我自己就做了一个文件浏览器



None.gif      public  partial  class  FileExplorerDll : UserControl
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif {
InBlock.gif        
public FileExplorerDll()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            InitializeComponent();
InBlock.gif            addNode(
this.treeView1);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private string selectName;
InBlock.gif
InBlock.gif        
public string SelectName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return selectName;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public new void Show()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Visible = true;
ExpandedSubBlockEnd.gif        }

InBlock.gif   
InBlock.gif        
private void addNode(TreeView tv)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string[] dirNames = Directory.GetDirectories(@"\");
InBlock.gif            
string[] fileNames = Directory.GetFiles(@"\");
InBlock.gif            
int index = 0;
InBlock.gif           
InBlock.gif            
foreach (string dirName in dirNames)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                tv.Nodes.Add(dirName);
InBlock.gif                addNode(treeView1.Nodes[index], dirName);
InBlock.gif                tv.Nodes[index].ImageIndex 
= 0;
InBlock.gif                index
++;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
foreach (string fileName in fileNames)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                tv.Nodes.Add(fileName);
InBlock.gif                tv.Nodes[index].ImageIndex 
= 1;
InBlock.gif                index
++;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void addNode(TreeNode tn, string path)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string[] dirNames;
InBlock.gif            
string[] fileNames;
InBlock.gif            
int index = 0;
InBlock.gif
InBlock.gif            
if (Directory.Exists(path))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                dirNames 
= Directory.GetDirectories(path);
InBlock.gif
InBlock.gif                
foreach (string dirName in dirNames)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    tn.Nodes.Add(dirName.Remove(
0, path.Length));
InBlock.gif                    addNode(tn.Nodes[index], dirName);
InBlock.gif                    tn.Nodes[index].ImageIndex 
= 0;
InBlock.gif                    index
++;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                fileNames 
= Directory.GetFiles(path);
InBlock.gif
InBlock.gif                
foreach (string fileName in fileNames)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    tn.Nodes.Add(fileName.Remove(
0, path.Length));
InBlock.gif                    tn.Nodes[index].ImageIndex 
= 1;
InBlock.gif                    index
++;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void button1_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            selectName 
= this.treeView1.SelectedNode.FullPath;
InBlock.gif            
this.Visible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void button2_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            selectName 
= "";
InBlock.gif            
this.Visible = false;
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }

基本功能实现了,可是加载的速度实在是慢!

还有一个巨大的缺陷,就是用户通过我的这个界面选择的文件地址无法返回,请高手指教,谢谢!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值