C#资源管理器源码

这段代码展示了如何使用C#构建一个简单的资源管理器,包括文件夹树视图和文件列表视图。通过`TreeView`展示目录结构,`ListView`显示文件信息,并实现了图标提取、文件操作等功能。
摘要由CSDN通过智能技术生成
// C#资源管理器源码
using  System;
using  System.Drawing;
using  System.Collections;
using  System.ComponentModel;
using  System.Windows.Forms;
using  System.Data;
using  System.IO;
using  System.Runtime.InteropServices;

namespace  myTree
{
    
/// <summary>
    
/// Form1 的摘要说明。
    
/// </summary>

    public class Form1 : System.Windows.Forms.Form
    
{
        
private System.Windows.Forms.ImageList TreeImageList;
        
private System.Windows.Forms.MainMenu mainMenu1;
        
private System.Windows.Forms.MenuItem menuItem1;
        
private System.Windows.Forms.ListView listView1;
        
private System.Windows.Forms.TextBox textBox1;
        
private System.Windows.Forms.TreeView treeView1;
        
private System.Windows.Forms.Panel panel2;
        
private System.Windows.Forms.Panel panel1;
        
private System.Windows.Forms.Splitter splitter1;
        
private System.Windows.Forms.Button button1;
        
private System.Windows.Forms.ImageList LisrimageList;
        
private System.Windows.Forms.ImageList LisrimageList2;
        
private System.Windows.Forms.StatusBar statusBar1;
        
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
        
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
        
private System.Windows.Forms.MenuItem menuItem2;
        
private System.Windows.Forms.MenuItem menuItem3;
        
private System.Windows.Forms.MenuItem menuItem4;
        
private System.Windows.Forms.MenuItem menuItem5;
        
private System.Windows.Forms.MenuItem menuItem6;
        
private System.Windows.Forms.MenuItem menuItem7;
        
private System.Windows.Forms.Label label1;
        
private System.ComponentModel.IContainer components;

        
public Form1()
        
{
            
//
            
// Windows 窗体设计器支持所必需的
            
//
            InitializeComponent();

            Icon ic0 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"15);
            TreeImageList.Images.Add(ic0);
            Icon ic1 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"5);
            TreeImageList.Images.Add(ic1);
            Icon ic2 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"7);
            TreeImageList.Images.Add(ic2);
            Icon ic3 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"11);
            TreeImageList.Images.Add(ic3);

            Icon ic4 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"3);
            TreeImageList.Images.Add(ic4);
            Icon ic5 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"4);
            TreeImageList.Images.Add(ic5);
            Icon ic6 
= myExtractIcon("%SystemRoot%/system32/shell32.dll"101);
            TreeImageList.Images.Add(ic6);


            GetDrive();
        }


        
/// <summary>
        
/// 清理所有正在使用的资源。
        
/// </summary>

        protected override void Dispose(bool disposing)
        
{
            
if (disposing)
            
{
                
if (components != null)
                
{
                    components.Dispose();
                }

            }

            
base.Dispose(disposing);
        }


        
Windows Form Designer generated code
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值