IconImageProvider
来源:互联网 发布:送巧克力知乎 编辑:程序博客网 时间:2024/06/12 22:43
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DropDrapFileSimple
{
class IconImageProvider
{
ImageList _SmallImageList;
ImageList _LargeImageList;
Dictionary<string, int> _ImageIndexDict = new Dictionary<string, int>();
public IconImageProvider(ImageList smallImageList, ImageList largeImageList)
{
_SmallImageList = smallImageList;
_LargeImageList = largeImageList;
}
/// <summary>
/// Get Iamge Index of this filename's Icon
/// </summary>
/// <param name="fileName">file name</param>
/// <returns></returns>
public int GetIconImageIndex(string fileName)
{
String extension = System.IO.Path.GetExtension(fileName).ToLower().Trim();
int index = -1;
if (_ImageIndexDict.TryGetValue(extension, out index))
{
return index;
}
if (_SmallImageList != null)
{
_SmallImageList.Images.Add(FileIcon.GetFileIcon(fileName, false));
index = _SmallImageList.Images.Count - 1;
}
if (_LargeImageList != null)
{
_LargeImageList.Images.Add(FileIcon.GetFileIcon(fileName, true));
index = _LargeImageList.Images.Count - 1;
}
_ImageIndexDict.Add(extension, index);
return index;
}
}
}
- IconImageProvider
- NSString和NSMutableString常用方法+NSArray常用代码
- platform_driver_register(struct platform_driver *drv)注册后如何找到驱动匹配的设备
- FileIcon
- 羌笛声声胡笳怨,此心长寄天涯远
- cocos2d-x与ios内存管理分析(在游戏中减少内存压力)
- IconImageProvider
- 3pcc
- poj 3335 Rotating Scoreboard(多边形的核存在性)
- Ubuntu 12.04 LTS下访问Windows域共享
- ListView用法
- 回溯算法
- cocos2d-x 开发中使用的一些工具
- Qt for wince窗口设置Qt::Popup出现异常
- 一个是阆苑仙葩,一个是美玉无瑕