http://www.cnblogs.com/over140/archive/2007/11/05/934452.html
重写Form的WndProc方法, if(m.msg==WM_COPY) 检查剪切板();
if(m.msg==WM_COPY) 检查剪切板();
C#文件下载 //加载绑定检索的下载文件 protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Name", typeof(string))); string serverPath = Server.MapPath("File"); DirectoryInfo dir = new DirectoryInfo(serverPath); foreach (FileInfo fileName in dir.GetFiles()) { DataRow dr = dt.NewRow(); dr[0] = fileName; dt.Rows.Add(dr); } ListBox1.DataSource = dt; ListBox1.DataTextField = "Name"; ListBox1.DataValueField = "Name"; ListBox1.DataBind(); } } //将绑定行索引保存到Session变量中 protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { Session["txt"] = ListBox1.SelectedValue.ToString(); } //下载保存文件 protected void LinkButton1_Click(object sender, EventArgs e) { if (Session["txt"] != "") { string path = Server.MapPath("File/") + Session["txt"].ToString(); FileInfo fi = new FileInfo(path); if (fi.Exists) { Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode( fi.Name)); Response.WriteFile(fi.FullName); //Response.End(); //Response.Flush(); //Response.Clear(); } } }
#define WM_COPY 0x0301
[quote=引用 2 楼 zq1564171310 的回复:] [quote=引用 1 楼 Z65443344 的回复:] 监视剪贴板.
[quote=引用 1 楼 Z65443344 的回复:] 监视剪贴板.
监视剪贴板.
111,092
社区成员
642,554
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧