10 2013 档案
摘要:1. Windows Forms中禁用窗体的关闭按钮 添加必要的命名空间: using System.Runtime.InteropServices; 添加必要的常数和API函数的引用 private const int SC_CLOSE = 0xF060; private const int MF_ENABLED = 0x00000000; private const int MF_GRAYED...
阅读全文
摘要:网上有很多用C#调用cmd的方法,大致如下: [c-sharp] view plaincopy private void ExecuteCmd(string command) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartIn...
阅读全文
摘要:1、使用 Stopwatch 类 (System.Diagnostics.Stopwatch)Stopwatch 实例可以测量一个时间间隔的运行时间,也可以测量多个时间间隔的总运行时间。在典型的 Stopwatch 方案中,先调用 Start 方法,然后调用 Stop 方法,最后使用 Elapsed 属性检查运行时间。Stopwatch 实例或者在运行,或者已停止;使用 IsRunning 可以确...
阅读全文
摘要:using Microsoft.Office.Interop.Excel;//转换为excel时,需要引用此命名空间 using ET;//转换为wps时,需要引用此命名空间using KSO;//转换为wps时,需要引用此命名空间当转换为excel时,需要引入Microsoft.Office.Interop.Excel.dll;当转换为wps时,需要引入Interop.ET.dll,Intero...
阅读全文