1.什么样的电p电网站不用软件就可以在线制作电子相册,而且只要步骤简单就行。相册相册
2.ç¨ASP.NETå建ç½ç»ç¸åä¿åç¾ä¸½è®°å¿
3.c# 电子相册代码
4.C#è¯è¨åççµåç¸åç³»ç»
什么样的网站不用软件就可以在线制作电子相册,而且只要步骤简单就行。电p电
须用以下动感影集、相册相册源码时代教务老师电子相册、源码源码提取文案源码照片视频制作软件,电p电
制作完成可在微信、手机、相册相册电脑、源码源码电视播放:
下载:
/mysoft/d0.asp?电p电gid=
按提示,安装完成即可永久使用
ç¨ASP.NETå建ç½ç»ç¸åä¿åç¾ä¸½è®°å¿
ããå¨æ们çæ¥å¸¸çæ´»ä¸æ°ç ç §å设å¤å·²ç»å¾æ®éäº æ们ä¼ç»å¸¸ææä¸äºç¸ç以ä¾ç念 èéçæ°ç ç §ççå¢å¤ å¾å¾éè¦å¾å¥½å°ç®¡çè¿äºç §ç 以便æ´å¥½å°æ¥é ç念 ç°å¨ç½ä¸æä¸å°ççµåç¸å é½è½å¾å¥½çå®ç°è¿äºåè½ é£æ们è½å¦èªå·±å¨æå建èªå·±çç¸åå¢ï¼å½ç¶å¯ä»¥ å¨è¿ç¯æç« ä¸ æ们å°å©ç¨asp net æ¥å建ä¸ä¸ªç®åçå¨çº¿ç¸å 以æ¶èæ们çç §çããé¦å æ¥çä¸ è¿ä¸ªç¸åæåªäºåè½ å¨è¿ä¸ªç¸åä¸ æä»¬å¿ é¡»å æé¢å æ影好çç §çæ¾å°ä¸ä¸ªç®å½ä¸å» ä¹å å¯ä»¥ä¾å¨ç½ä¸ä½¿ç¨ ä¸ä¸å¼ ä¸ä¸å¼ çé¾æ¥ä¸å¼ å¼ å°æ¥ç
ããä¸é¢å ä»ç»å¦ä½è·å¾æ件夹ä¸çå¾ç æ们å¯ä»¥ä½¿ç¨System IOå½å空é´ä¸çDirectoryInfoç±»æ¥å®ç° å°æ件夹æå¨çè·¯å¾å为åæ°ä¼ éå°è¯¥ç±»çæé å½æ°ä¸ 并声æä¸ä¸ªDirectoryInfoç±»çå®ä¾ DirectoryInfoç±»ä¸æä¸ä¸ªGetFiles()çæ¹æ³ ä¼è¿åFileInfoç对象æ°ç» èæ¯ä¸ä¸ªFileInfoçå®ä¾å°å å«æå®è·¯å¾ä¸æ件çå ·ä½ä¿¡æ¯ ä¸é¢ç代ç ç段说æäºè¯¥è¿ç¨
ãã以ä¸ä¸ºå¼ç¨çå 容 Sub Page_Load(sender as Object e as EventArgs)ã Get list of imagesãDim dirInfo as New DirectoryInfo(Server MapPath( ))ãDim images() as FileInfo = FilterForImages(dirInfo GetFiles())ã End Subããå ¶ä¸ ç¨Server mappathè·å¾å½åç®å½çè·¯å¾ èdirinfo getfiles()å°ä¼è¿å该ç®å½ä¸çæææ件 èç±äºæ们çæ¯ç¸å åªéè¦çå°æ¯å¦JPG BMP GIFçå¾è±¡æ件 æ以æ们å¯ä»¥éè¿ç¨åºå®ç° åªè£ è½½è¿äºç±»åçæ件 è¿éè¿ä¸ä¸ªèªå®ä¹çè¿ç¨FilterForImagesæ¥å®ç° 该è¿ç¨å°åªè¿åæå®æ件夹ä¸å¾è±¡ç±»åçæ件 代ç å¦ä¸
以ä¸ä¸ºå¼ç¨çå 容 Function FilterForImages(images() as FileInfo) as FileInfo()ãDim newImages as New ArrayList(images Length)
ãDim i as IntegerãFor i = to images Length ããIf Path GetExtension(images(i) Name) = jpg OrElse _ãããPath GetExtension(images(i) Name) = jpeg OrElse _ ãããPath GetExtension(images(i) Name) = png OrElse _ ãããPath GetExtension(images(i) Name) = gif thenããããnewImages Add(images(i))ããEnd IfãNext
ãReturn CType(newImages ToArray(GetType(FileInfo)) FileInfo())End Function
ãã该è¿ç¨å¯¹äºä¼ éè¿æ¥çFileInfoåæ°æ°ç»è¿è¡éå 对æ件夹ä¸çæ件çåç¼åè¿è¡åæ å¦æå±äºå¾è±¡æ件 åæ·»å å°newimagesæ°ç»ä¸å» 并以arraylistå½¢å¼è¿å
ããæ¥ä¸æ¥ æ们çä¸å¦ä½æ¾ç¤ºæ¯ä¸å¼ å¾ç 并以 ä¸ä¸å¼ ä¸ä¸å¼ æ¥æ¾ç¤º 为äºç¥éå½åæµè§çæ¯ç¬¬å å¼ å¾ç å¯ä»¥éè¿ä½¿ç¨ä¼ éåæ°çæ¹æ³æ¥å®ç° å å¾çªä½ä¸æ·»å ä¸ä¸ªimageæ§ä»¶åææ¬æ¡ ç¨åºä»£ç å¦ä¸
以ä¸ä¸ºå¼ç¨çå 容 Sub Page_Load(sender as Object e as EventArgs)ã
ã Dim imgIndex as Integer = ãIf Not Request QueryString( N ) is 相册相册Nothing AndAlso _ããIsNumeric(Request QueryString( N )) thenãããimgIndex = CInt(Request QueryString( N ))ãEnd IfããcurrentImgTitle Text = You are Viewing: & _ããPath GetFileNameWithoutExtension(images(imgIndex) Name) & _ãã ( & imgIndex + & of & images Length & ) ãããcurrentImg ImageUrl = Path GetFileName(images(imgIndex) Name)ããã End Sub
ããHTMLé¨å代ç
以ä¸ä¸ºå¼ç¨çå 容 <asp:Label runat= server id= currentImgTitle /><br /><asp:Image runat= server id= currentImg /> lishixinzhi/Article/program/net//c# 电子相册代码
页面:
<%@ Page language="c#" Codebehind="filesystem.aspx.cs" AutoEventWireup="false" Inherits="WebShop.filesystem" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>filesystem</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="/intellisense/ie5" name="vs_targetSchema">
<LINK href="CssStyle.css" type="text/css" rel="stylesheet">
<form id="Form1" method="post" runat="server">
</HEAD>
<body MS_POSITIONING="GridLayout">
<FONT face="宋体">
<table cellSpacing="1" cellPadding="0" width="" align="center" bgColor="#" border="0">
<tr>
<td bgColor="#c" colSpan="3"><IMG src="images/FileSystemBaner.gif"></td>
</tr>
<tr>
<td width="" bgColor="#e3e3e3" rowSpan="2">
<asp:linkbutton id="LinkButton1" runat="server">后退</asp:linkbutton></td>
<td width="" bgColor="#efefef" colSpan="2">
<asp:datalist id="DataList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" DataKeyField="Name"
Width="">
<ItemTemplate>
<table width="" align="center">
<tr>
<td align="center" width=""></td>
<td align="left" width=""><%#DataBinder.Eval(Container.DataItem,"Image")%>
</td>
</tr>
<tr>
<td width="" align="right">
<asp:CheckBox ID="checkBox1" Runat="server" /></td>
<td width="" align="left"><font face="宋体"><%#DataBinder.Eval(Container.DataItem,"Name")%></font></td>
</tr>
</table>
</ItemTemplate>
</asp:datalist></td>
</tr>
<tr>
<td align="right" bgColor="#efefef" colSpan="2"><asp:button id="Button3" runat="server" Text="删除选中项"></asp:button>
<input id="fileFeild1" type="file" name="fileFeild1" runat="server">
<asp:button id="Button1" runat="server" Text="确定上传"></asp:button><br>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:button id="Button2" runat="server" Text="创建目录"></asp:button></td>
</tr>
<tr>
<td bgColor="#" colSpan="3"><span class="STYLE1"><asp:label id="Label2" runat="server" ForeColor="White"> 当前所在位置:</asp:label><SPAN class="STYLE1"><asp:label id="Label1" runat="server" ForeColor="White" Width="px"></asp:label></SPAN></span></td>
</tr>
</table>
</FONT></FORM>
</body>
</HTML>
后台代码:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebShop
{
/// <summary>
/// filesystem 的摘要说明。
/// </summary>
public class filesystem : System.Web.UI.Page
{
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.DataList DataList1;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.HtmlControls.HtmlInputFile fileFeild1;
private void Page_Load(object sender,源码源码 System.EventArgs e)
{
if(!IsPostBack)
{
Bind();
}
}
private void Bind()
{
string initpath="";
if(Request["path"]==null)
{
initpath=Server.MapPath("FileSystem");
}
else
{
initpath=Request["path"];
}
this.Label1.Text=initpath;
DataTable dt=new DataTable();
DataColumn dc0=new DataColumn("Image",System.Type.GetType("System.String"));
dt.Columns.Add(dc0);
DataColumn dc1=new DataColumn("Name",System.Type.GetType("System.String"));
dt.Columns.Add(dc1);
DirectoryInfo di=new DirectoryInfo(this.Label1.Text);
DirectoryInfo[] dis=di.GetDirectories();
foreach(DirectoryInfo d in dis)
{
DataRow dr=dt.NewRow();
dr[0]="<a href='filesystem.aspx?path="+HttpUtility.UrlEncode(d.FullName,System.Text.Encoding.UTF8)+"'><img src='images/folder.gif' border=0/></a>";
dr[1]=d.Name;
dt.Rows.Add(dr);
}
FileInfo[] fis=di.GetFiles();
foreach(FileInfo f in fis)
{
string ex=f.Extension.ToLower();
if(ex==".jpg" || ex==".jpeg" || ex==".gif" || ex==".png" || ex==".bmp")
{
string fullname=f.FullName;
string urlpath=fullname.Substring(fullname.IndexOf("FileSystem"));
string url=HttpUtility.UrlEncode(urlpath,System.Text.Encoding.UTF8);
DataRow dr=dt.NewRow();
dr[0]="<a href='"+url+"' target='_blank'><img src='"+url+"' border=0 width= height=/></a>";
dr[1]=f.Name;
dt.Rows.Add(dr);
}
}
this.DataList1.DataSource=dt;
this.DataList1.DataBind();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的电p电互助商城源码下载方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LinkButton1_Click(object sender,相册相册 System.EventArgs e)
{
string Parent=Directory.GetParent(this.Label1.Text).ToString();
if(Parent.IndexOf("FileSystem")>-1)
{
Response.Redirect("filesystem.aspx?path="+Parent);
}
else
{
return;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
HttpPostedFile hpf=this.fileFeild1.PostedFile;
string ClientPath=hpf.FileName;
string filename=Path.GetFileName(ClientPath);
string ex=Path.GetExtension(filename);
if(ex==".jpg" || ex==".jpeg" || ex==".gif" || ex==".png" || ex==".bmp")
{
string SavePath=this.Label1.Text+"\\"+filename;
hpf.SaveAs(SavePath);
Bind();
}
else
{
Response.Write(Tools.GetAlertJS("所上传的格式不正确!"));
return;
}
}
private void Button2_Click(object sender,源码源码怎样获取内核源码 System.EventArgs e)
{
string filename=this.TextBox1.Text;
Directory.CreateDirectory(this.Label1.Text+"\\"+filename);
Bind();
}
private void Button3_Click(object sender, System.EventArgs e)
{
for(int i=0;i<this.DataList1.Items.Count;i++)
{
if(((CheckBox)this.DataList1.Items[i].FindControl("CheckBox1")).Checked)
{
int index=this.DataList1.Items[i].ItemIndex;
string filePath=this.Label1.Text+"\\"+this.DataList1.DataKeys[index].ToString();
if(Directory.Exists(filePath))
{
Directory.Delete(filePath,true);
}
if(File.Exists(filePath))
{
File.Delete(filePath);
}
Bind();
}
}
}
}
}
C#è¯è¨åççµåç¸åç³»ç»
é¦å éè¦å¨å级ç®å½ä¸å»ºç«æ件夹FileSystem
//åå°ä»£ç :
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebShop
{
/// <summary>
/// filesystem çæè¦è¯´æã
/// </summary>
public class filesystem : System.Web.UI.Page
{
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.DataList DataList1;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.HtmlControls.HtmlInputFile fileFeild1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
Bind();
}
}
private void Bind()
{
string initpath="";
if(Request["path"]==null)
{
initpath=Server.MapPath("FileSystem");
}
else
{
initpath=Request["path"];
}
this.Label1.Text=initpath;
DataTable dt=new DataTable();
DataColumn dc0=new DataColumn("Image",System.Type.GetType("System.String"));
dt.Columns.Add(dc0);
DataColumn dc1=new DataColumn("Name",System.Type.GetType("System.String"));
dt.Columns.Add(dc1);
DirectoryInfo di=new DirectoryInfo(this.Label1.Text);
DirectoryInfo[] dis=di.GetDirectories();
foreach(DirectoryInfo d in dis)
{
DataRow dr=dt.NewRow();
dr[0]="<a href='filesystem.aspx?path="+HttpUtility.UrlEncode(d.FullName,System.Text.Encoding.UTF8)+"'><img src='images/folder.gif' border=0/></a>";
dr[1]=d.Name;
dt.Rows.Add(dr);
}
FileInfo[] fis=di.GetFiles();
foreach(FileInfo f in fis)
{
string ex=f.Extension.ToLower();
if(ex==".jpg" || ex==".jpeg" || ex==".gif" || ex==".png" || ex==".bmp")
{
string fullname=f.FullName;
string urlpath=fullname.Substring(fullname.IndexOf("FileSystem"));
string url=HttpUtility.UrlEncode(urlpath,System.Text.Encoding.UTF8);
DataRow dr=dt.NewRow();
dr[0]="<a href='"+url+"' target='_blank'><img src='"+url+"' border=0 width= height=/></a>";
dr[1]=f.Name;
dt.Rows.Add(dr);
}
}
this.DataList1.DataSource=dt;
this.DataList1.DataBind();
}
#region Web çªä½è®¾è®¡å¨çæç代ç
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该è°ç¨æ¯ ASP.NET Web çªä½è®¾è®¡å¨æå¿ éçã
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计å¨æ¯ææéçæ¹æ³ - ä¸è¦ä½¿ç¨ä»£ç ç¼è¾å¨ä¿®æ¹
/// æ¤æ¹æ³çå 容ã
/// </summary>
private void InitializeComponent()
{
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LinkButton1_Click(object sender, System.EventArgs e)
{
string Parent=Directory.GetParent(this.Label1.Text).ToString();
if(Parent.IndexOf("FileSystem")>-1)
{
Response.Redirect("filesystem.aspx?path="+Parent);
}
else
{
return;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
HttpPostedFile hpf=this.fileFeild1.PostedFile;
string ClientPath=hpf.FileName;
string filename=Path.GetFileName(ClientPath);
string ex=Path.GetExtension(filename);
if(ex==".jpg" || ex==".jpeg" || ex==".gif" || ex==".png" || ex==".bmp")
{
string SavePath=this.Label1.Text+"\\"+filename;
hpf.SaveAs(SavePath);
Bind();
}
else
{
Response.Write(Tools.GetAlertJS("æä¸ä¼ çå¾çæ ¼å¼ä¸æ£ç¡®ï¼"));
return;
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
string filename=this.TextBox1.Text;
Directory.CreateDirectory(this.Label1.Text+"\\"+filename);
Bind();
}
private void Button3_Click(object sender, System.EventArgs e)
{
for(int i=0;i<this.DataList1.Items.Count;i++)
{
if(((CheckBox)this.DataList1.Items[i].FindControl("CheckBox1")).Checked)
{
int index=this.DataList1.Items[i].ItemIndex;
string filePath=this.Label1.Text+"\\"+this.DataList1.DataKeys[index].ToString();
if(Directory.Exists(filePath))
{
Directory.Delete(filePath,true);
}
if(File.Exists(filePath))
{
File.Delete(filePath);
}
Bind();
}
}
}
}
}
åå°é¡µé¢:
<%@ Page language="c#" Codebehind="filesystem.aspx.cs" AutoEventWireup="false" Inherits="WebShop.filesystem" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>filesystem</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="/intellisense/ie5" name="vs_targetSchema">
<LINK href="CssStyle.css" type="text/css" rel="stylesheet">
<form id="Form1" method="post" runat="server">
</HEAD>
<body MS_POSITIONING="GridLayout">
<FONT face="å®ä½">
<table cellSpacing="1" cellPadding="0" width="" align="center" bgColor="#" border="0">
<tr>
<td bgColor="#c" colSpan="3"><IMG src="images/FileSystemBaner.gif"></td>
</tr>
<tr>
<td width="" bgColor="#e3e3e3" rowSpan="2">
<asp:linkbutton id="LinkButton1" runat="server">åé</asp:linkbutton></td>
<td width="" bgColor="#efefef" colSpan="2">
<asp:datalist id="DataList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" DataKeyField="Name"
Width="">
<ItemTemplate>
<table width="" align="center">
<tr>
<td align="center" width=""></td>
<td align="left" width=""><%#DataBinder.Eval(Container.DataItem,"Image")%>
</td>
</tr>
<tr>
<td width="" align="right">
<asp:CheckBox ID="checkBox1" Runat="server" /></td>
<td width="" align="left"><font face="å®ä½"><%#DataBinder.Eval(Container.DataItem,"Name")%></font></td>
</tr>
</table>
</ItemTemplate>
</asp:datalist></td>
</tr>
<tr>
<td align="right" bgColor="#efefef" colSpan="2"><asp:button id="Button3" runat="server" Text="å é¤éä¸é¡¹"></asp:button>
<input id="fileFeild1" type="file" name="fileFeild1" runat="server">
<asp:button id="Button1" runat="server" Text="ç¡®å®ä¸ä¼ "></asp:button><br>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:button id="Button2" runat="server" Text="å建ç®å½"></asp:button></td>
</tr>
<tr>
<td bgColor="#" colSpan="3"><span class="STYLE1"><asp:label id="Label2" runat="server" ForeColor="White"> å½åæå¨ä½ç½®ï¼</asp:label><SPAN class="STYLE1"><asp:label id="Label1" runat="server" ForeColor="White" Width="px"></asp:label></SPAN></span></td>
</tr>
</table>
</FONT></FORM>
</body>
</HTML>