类似windows explorer的图片浏览器
来源:互联网 发布:各种拍照软件 编辑:程序博客网 时间:2024/05/21 02:34
windows explore在查看文件中有查看缩略图这一选项,他的实质就是从thumbs文件中读取出已经生成的缩略图文件
然后做为image显示出来
在网上有如何读出thumbs文件的类库,今天使用这个类库模仿一下window explorer
类库的源地址
http://www.petedavis.net/MySite/DynPageView.aspx?pageid=31
原理读出thumbs文件中的图像并生成一个picturebox数组,显示图像并放置到窗体上,在picturebox被单击时,击发一个事件
将原图显示出来
private string[] allfilename;
ThumbDBLib.ThumbDB test;
private PictureBox[] allimage;
private void button1_Click(object sender, System.EventArgs e)
...{
this.Invalidate();
test=new ThumbDB(this.textBox1.Text);
allfilename=test.GetThumbfiles();
allimage=new PictureBox[allfilename.Length];
int x=0,y=50;
int i=0;
foreach(string bb in allfilename)
...{
allimage[i]=new PictureBox();
allimage[i].Location=new Point(x,y);
Image gotimg=test.GetThumbnailImage(bb);
x+=80;
if(x>this.Width)
...{
x=0;
y+=80;
}
allimage[i].Image=gotimg;
allimage[i].Size=new Size(75,75);
allimage[i].SizeMode=PictureBoxSizeMode.StretchImage;
allimage[i].Click+=new EventHandler(ImageControl_Click);
allimage[i].Tag=bb;
this.Controls.Add(allimage[i]);
//this.Refresh();
i++;
}
}
/**//// <summary>
/// 当用户单击时显示大图片
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ImageControl_Click(object sender, EventArgs e)
...{
Form showbig=new Form();
string filename=Utitlity.GetDirFromFileName(textBox1.Text)+"/"+(sender as PictureBox).Tag;
PictureBox pb=new PictureBox();
Bitmap showmap=new Bitmap(filename);
pb.Image=showmap;
pb.Size=new Size(showmap.Width,showmap.Height);
showbig.Size=new Size(showmap.Width,showmap.Height);
pb.Location=new Point(0,0);
showbig.Controls.Add(pb);
if(showbig.ShowDialog()==DialogResult.OK)
...{
showbig.Dispose();
}
}
public class Utitlity
...{
/**//// <summary>
/// 从文件名中取出文件路径
/// </summary>
/// <param name="filename">文件名</param>
/// <returns>文件所在的路径</returns>
public static string GetDirFromFileName(string filename)
...{
string[] allpart=filename.Split('/');
return filename.Replace(allpart[allpart.Length-1],string.Empty);
}
}
ThumbDBLib.ThumbDB test;
private PictureBox[] allimage;
private void button1_Click(object sender, System.EventArgs e)
...{
this.Invalidate();
test=new ThumbDB(this.textBox1.Text);
allfilename=test.GetThumbfiles();
allimage=new PictureBox[allfilename.Length];
int x=0,y=50;
int i=0;
foreach(string bb in allfilename)
...{
allimage[i]=new PictureBox();
allimage[i].Location=new Point(x,y);
Image gotimg=test.GetThumbnailImage(bb);
x+=80;
if(x>this.Width)
...{
x=0;
y+=80;
}
allimage[i].Image=gotimg;
allimage[i].Size=new Size(75,75);
allimage[i].SizeMode=PictureBoxSizeMode.StretchImage;
allimage[i].Click+=new EventHandler(ImageControl_Click);
allimage[i].Tag=bb;
this.Controls.Add(allimage[i]);
//this.Refresh();
i++;
}
}
/**//// <summary>
/// 当用户单击时显示大图片
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ImageControl_Click(object sender, EventArgs e)
...{
Form showbig=new Form();
string filename=Utitlity.GetDirFromFileName(textBox1.Text)+"/"+(sender as PictureBox).Tag;
PictureBox pb=new PictureBox();
Bitmap showmap=new Bitmap(filename);
pb.Image=showmap;
pb.Size=new Size(showmap.Width,showmap.Height);
showbig.Size=new Size(showmap.Width,showmap.Height);
pb.Location=new Point(0,0);
showbig.Controls.Add(pb);
if(showbig.ShowDialog()==DialogResult.OK)
...{
showbig.Dispose();
}
}
public class Utitlity
...{
/**//// <summary>
/// 从文件名中取出文件路径
/// </summary>
/// <param name="filename">文件名</param>
/// <returns>文件所在的路径</returns>
public static string GetDirFromFileName(string filename)
...{
string[] allpart=filename.Split('/');
return filename.Replace(allpart[allpart.Length-1],string.Empty);
}
}
- 类似windows explorer的图片浏览器
- Process Explorer windows 下的进程浏览器
- windows下打印图片出现explorer.exe错误的问题?
- win10 Windows图片浏览器缺失的解决办法
- Scroll View 控件以Thumbnail的方式显示一个文件夹的所有图片,类似图片浏览器
- 替代Windows Explorer的软件
- 一个IE浏览器Explorer Bar的例子
- 使用Scroll View显示一个文件夹的缩略图,类似图片浏览器(2)
- js框架jquery多行多列滚动图片特效(类似360,遨游、百度,google浏览器的新建标签)
- Windows Internet Explorer的两三点
- 模仿windows图片浏览器(续)
- emacs 实现类似浏览器的页签
- 实现类似UC浏览器的菜单
- 火狐浏览器上类似HTTPWATCH的插件
- 实现类似浏览器的缩放页面比例
- Internet Explorer 7+ ,微软的vista IE 浏览器
- 如何使用BHO定制你的Internet Explorer浏览器
- 如何使用BHO定制你的Internet Explorer浏览器
- 在linux下测试串口的简单方法
- 关于GridView翻页checkBox状态保存的问题
- 重温Linux源代码 -- 启动代码
- vb.net2005 LinkLabel1的使用
- SQL2005连接字符串
- 类似windows explorer的图片浏览器
- 男性必看 20种解酒良方
- 大虾们,请问怎么实现注册一个会员自动分配一个二级域名。
- Ubuntu Linux安装NetBeans的显示问题的解决!~
- org.apache.commons.beanutils.ConversionException:
- 牛人恶搞中国移动话务员
- 成功的背后!(给所有IT人)zz
- 好教材与坏教材之争本质上是个伪问题
- 除了爱情,女人应该知道的事