Go to my github
上一页 1 ··· 11 12 13 14 15
摘要: 本文摘自人民邮电出版社出版的《Windows Forms程序设计》(Chris Sells著,荣耀、蒋贤哲译)。 通过一个栩栩如生的虚构故事解释了C#/.NET中委托和事件的机制和应用。 1 委托 从前,在南方的一个异国他乡,有一个叫Peter的勤劳的工人,他对老板(boss)百依百顺,然而他的boss却是个卑鄙多疑的家伙,他坚持要求Peter不断汇报工作进展。由于Peter不希望被boss盯着干活,于是他向boss承诺随时汇报工作进度。Peter通过如下所示的类型化的引用(typed reference)定期回调boss来实现这个承诺: class Worker { public void 阅读全文
posted @ 2008-12-10 09:08 峡谷少爷 阅读(253) 评论(0) 推荐(0)
摘要: 昨天晚上看MSDN看见的一段通过使用SetClassLong函数使窗口下面拥有一个阴影效果,研究代码找资料弄了半个小时把它运用在了C#2.0上,特此一贴。由于我使用的方法是调用系统API,所以在引用声明这块要加上一句:using System.Runtime.InteropServices;然后再窗口类的随便哪个地方加上:const int CS_DROPSHADOW = 0x20000;const int GCL_STYLE = (-26);//声明Win32 API[DllImport("user32.dll", CharSet = CharSet.Auto)]public static 阅读全文
posted @ 2008-11-11 10:43 峡谷少爷 阅读(588) 评论(0) 推荐(0)
摘要: /// /// 开启SQL Server服务 /// public static void ProSQLServer() { Process pro = new Process(); pro.StartInfo.FileName = "cmd.exe"; pro.StartInfo.UseShellExecute = false; pro.StartInfo.RedirectStandardInput = true; pro.StartInfo.RedirectStandardOutput = true; pro.StartInfo.RedirectStandardError = true 阅读全文
posted @ 2008-11-07 10:54 峡谷少爷 阅读(224) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15