COMPUTER_LZY

要输就输给追求,要嫁就嫁给幸福

导航

2011年11月8日 #

将WinForm的初始化界面置于屏幕的中央

摘要: Screenscreen=Screen.AllScreens[0];intiX=(screen.Bounds.Size.Width-Size.Width)/2;intiY=(screen.Bounds.Size.Height-Size.Height)/2;Location=newPoint(iX,iY); 阅读全文

posted @ 2011-11-08 15:22 CANYOUNG 阅读(736) 评论(0) 推荐(0) 编辑

TCPServer、TCPClient

摘要: TCPServer: TCP 网络客户端侦听连接。可使用 TcpClient 或 Socket 来连接 TcpListener。可使用 IPEndPoint、本地 IP 地址及端口号或者仅使用端口号,来创建 TcpListener。可以将本地 IP 地址指定为 Any,将本地端口号指定为 0(如果希望基础服务提供程序为您分配这些值)。如果您选择这样做,可在连接套接字后使用 LocalEndpoint 属性来标识已指定的信息。 Start 方法用来开始侦听传入的连接请求。Start 将对传入连接进行排队,直至您调用 Stop 方法或它已经完成 MaxConnections 排队为止。可使用 .. 阅读全文

posted @ 2011-11-08 15:00 CANYOUNG 阅读(31612) 评论(1) 推荐(0) 编辑

ASP.NET 上传、下载

摘要: ///<summary>///上传文件///</summary>///<paramname="path"></param>///<returns></returns>protectedboolUploadfile(stringpath){boolflag=false;if(FileUpload1.HasFile){stringfileName=FileUpload1.FileName;if(!CfileName(path,fileName)){path+=fileName;FileUpload1.Sav 阅读全文

posted @ 2011-11-08 13:24 CANYOUNG 阅读(237) 评论(0) 推荐(0) 编辑

C#导出Excel

摘要: ExcelHelper:publicclassExcelHelper{publicstaticvoidExport(System.Data.DataTabledt,stringfilePath){if(dt==null){thrownewException("数据表中无数据");}inteRowIndex=1;inteColIndex=1;intcols=dt.Columns.Count;introws=dt.Rows.Count;Microsoft.Office.Interop.Excel.ApplicationxlApp=newMicrosoft.Office.Inte 阅读全文

posted @ 2011-11-08 09:54 CANYOUNG 阅读(818) 评论(0) 推荐(0) 编辑