你要说清楚你的要求,有没有具体的限制,如无,只要服务器上有sql server,连上服务器的sql server,调用扩展存储过程:xp_dirtree,就能获取服务器的文件列表
解决方案 »
- c#语言做了个系统加载了地图,想实现在listview中点击某一行属性,在地图上对应高亮显示出来怎样实现? 求代码
- VS2010 总是有着三项警告
- 两个TextBox,0-9数字button,怎样点击数字button,将数字填到所聚焦的TextBox中
- 贴段代码,自已简单的重新封装了一个控件,请大家帮忙看看,指点一下
- c#不明白这个结果是怎么来的,帮忙讲解一下,请看题
- 如何使一个按钮按TAB键不经过它?
- 存储图片(C#+Winform+SQL Server)
- 请教各位 ,我在用从c#做财务软件,请问,'凭证窗体'怎么来做,有没有控件可用
- 在线急等!!asp怎么运行可执行程序?不是点击运行而是一运行网页马上自动运行。
- Do I have to have Main to compile my C# file?
- 关于文件读写
- 判断一个对象A是不是类B的实例,怎么办?
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;namespace DayOfDeveloper
{
public class ThumbnailGenerator : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
String _path = Server.MapPath("images/");
if ( !_path.EndsWith(@"\") )
_path += @"\"; DirectoryInfo _di = new DirectoryInfo(_path);
FileInfo[] _fi = _di.GetFiles("*.jpg"); foreach ( FileInfo _f in _fi)
{
if ( !_f.Name.StartsWith("thumb_") )
{
String _imgName = _f.Name;
System.Drawing.Image _img = System.Drawing.Image.FromFile(_path + _imgName); if ( _img.Height > 72 )
{
Int32 _height = _img.Height;
Int32 _width = _img.Width;
Bitmap _imgOutput;
Double _dif; _dif = Convert.ToDouble(Decimal.Divide(_width,_height));
_width = Convert.ToInt32(Math.Ceiling(72 * _dif));
_imgOutput = new Bitmap(_img, _width, 72);
_img.Dispose(); try
{
_imgOutput.Save(_path + "thumb_" + _imgName.ToLower(), System.Drawing.Imaging.ImageFormat.Jpeg);
_imgOutput.Dispose();
Response.Write("thumb_" + _imgName.ToLower() + " Saved</b><br>");
}
catch ( Exception _ex )
{
Response.Write("<b>Error Saving File</b><br>");
Response.Write(_ex.Message);
Response.Write("<br>");
Response.Write(_ex.StackTrace);
Response.Write("<br>");
}
}
}
}
} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}