找传奇、传世资源到传世资源站!

C# winform 仿文件浏览器 例子源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

C# winform 仿文件浏览器 例子源码 C#语言基础-第1张#region Using directivesusing System;using System.Collections.Generic;using System.Text;#endregionusing System.IO;using System.Drawing;namespace System.Windows.Forms.Samples{ public class FileView { private string _path; private string _name; private long _size; private DateTime _modified; private DateTime _created; private string _type; private Icon _icon; public FileView(string path) : this(new FileInfo(path)) { } public FileView(FileSystemInfo fileInfo) { SetState(fileInfo); } public bool IsDirectory { get { return (_size == -1); } } private void SetState(FileSystemInfo fileInfo) { _path = fileInfo.FullName; _name = fileInfo.Name; // Check if not a directory (size is not valid) if (fileInfo is FileInfo) { _size = (fileInfo as FileInfo).Length; } else { _size = -1; } _modified = fileInfo.LastWriteTime; _created = fileInfo.CreationTime; // Get Type Name Win32.SHFILEINFO info = Win32.ShellGetFileInfo.GetFileInfo(fileInfo.FullName); _type = info.szTypeName; // Get ICON _icon = System.Drawing.Icon.FromHandle(info.hIcon); } public string Name { get { return _name; } set { _name = value; } } public long Size { get { return _size; } } public DateTime DateModified { get { return _modified; } } public DateTime DateCreated { get { return _created; } } public string Type { get { return _type; } } public Icon Icon { get { return _icon; } } public void Update() { // Reset state SetState(new FileInfo(_path)); } public string FullName { get { return _path; } } public void Update(FileSystemInfo fsi) { // Reset state - name changed SetState(fsi); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复