最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#顯示文件夾下所有圖片文件的方法

 更新時(shí)間:2015年04月22日 12:08:17   作者:songguo  
這篇文章主要介紹了C#顯示文件夾下所有圖片文件的方法,涉及C#操作圖片文件的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了C#顯示文件夾下所有圖片文件的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

<%@ Page Language="C#" EnableViewState="false" %>
<%@ Import Namespace="System.IO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
 protected void Page_Load(object sender, EventArgs e)
 {
  FileInfo[] fs1 = (new DirectoryInfo(Server.MapPath("~/A"))).GetFiles();
  FileInfo[] fs2 = (new DirectoryInfo(Server.MapPath("~/B"))).GetFiles();
  FileInfo[] fs3 = (new DirectoryInfo(Server.MapPath("~/C"))).GetFiles();
  FileInfo[] fs4 = (new DirectoryInfo(Server.MapPath("~/D"))).GetFiles();
  FileInfo[] fs5 = (new DirectoryInfo(Server.MapPath("~/E"))).GetFiles();
  var fs = fs1.Concat(fs2).Concat(fs3).Concat(fs4).Concat(fs5);
  Repeater1.DataSource = fs;
  Repeater1.DataBind();
 }
 string GetUrl(object img)
 {
  FileInfo f = img as FileInfo;
  return Page.ResolveUrl("~")+f.DirectoryName.Substring(f.DirectoryName.LastIndexOf("\")+1)+"/"+f.Name;
 }
</script>
<html>
<head>
 <title></title>
</head>
<body>
 <form id="form1" runat="server">
 <asp:Repeater ID="Repeater1" runat="server">
  <ItemTemplate>
   <div><a href='<%#GetUrl(Container.DataItem) %>'>
    <img src='<%#GetUrl(Container.DataItem) %>' /></a></div>
  </ItemTemplate>
 </asp:Repeater>
 </form>
</body>
</html>

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

高淳县| 甘孜县| 河源市| 桓仁| 许昌县| 思茅市| 开阳县| 额济纳旗| 姚安县| 延长县| 浪卡子县| 肃南| 西安市| 衡阳县| 博野县| 慈利县| 象山县| 贺兰县| 五莲县| 延边| 兖州市| 即墨市| 壶关县| 蓝山县| 九台市| 云南省| 扶沟县| 江孜县| 静乐县| 滕州市| 南和县| 泗阳县| 湘潭市| 井研县| 安新县| 阿拉善右旗| 沙雅县| 安多县| 新巴尔虎右旗| 康乐县| 新宾|