public bool EnableRaisingEvents { get; set; }//獲取或設(shè)置在進(jìn)程終止時(shí)是否應(yīng)激發(fā) Exited 事件。
public event EventHandler Exited //在進(jìn)程退出時(shí)發(fā)生。進(jìn)程退出的時(shí)候,一般需要把Process對(duì)象釋放掉[比如一個(gè)Windows應(yīng)用程序里面另外打開其他的exe,其他exe關(guān)閉后的處理]
public static AppDomain CurrentDomain { get; } //獲取當(dāng)前 Thread 的當(dāng)前應(yīng)用程序域。
public event UnhandledExceptionEventHandler UnhandledException //當(dāng)某個(gè)異常未被捕獲時(shí)出現(xiàn)。
詳細(xì)的信息還是去msdn上查看,特別是要看備注
public static string CommonAppDataPath { get; } 可以把程序的日志寫在此路徑下,即便是用戶切換了Windows用戶,還是可以看到程序的以前的日志//獲取所有用戶共享的應(yīng)用程序數(shù)據(jù)的路徑。
public static string StartupPath { get; } //獲取啟動(dòng)了應(yīng)用程序的可執(zhí)行文件的路徑,不包括可執(zhí)行文件的名稱。
public static void Exit() //通知所有消息泵必須終止,并且在處理了消息以后關(guān)閉所有應(yīng)用程序窗口。public static void EnableVisualStyles() //啟用應(yīng)用程序的可視樣式。 新建一個(gè)windows窗體應(yīng)用程序的時(shí)候會(huì)調(diào)用
public static void SetCompatibleTextRenderingDefault(bool defaultValue) 新建windows窗體應(yīng)用程序的時(shí)候會(huì)調(diào)用,傳遞的參數(shù)是false//將某些控件上定義的 UseCompatibleTextRendering 屬性設(shè)置為應(yīng)用程序范圍內(nèi)的默認(rèn)值。defaultValue 用于新控件的默認(rèn)值。如果為 true,則支持 UseCompatibleTextRendering 的新控件使用基于 GDI+ 的 Graphics 類進(jìn)行文本呈現(xiàn);如果為 false,則新控件使用基于 GDI 的 TextRenderer 類。
public static void Run(Form mainForm) 新建windows窗體應(yīng)用程序的時(shí)候會(huì)調(diào)用,傳遞的參數(shù)是新建的一個(gè)Form主窗體//在當(dāng)前線程上開始運(yùn)行標(biāo)準(zhǔn)應(yīng)用程序消息循環(huán),并使指定窗體可見。
public static void DoEvents() //處理當(dāng)前在消息隊(duì)列中的所有 Windows 消息。
public static void Restart() The most common reason for calling Restart is to start a new version of the application that you have downloaded through ClickOnce using the Update or UpdateAsync method.(還是英文準(zhǔn)確,機(jī)器翻譯的中文簡(jiǎn)直是慘不忍睹)//關(guān)閉應(yīng)用程序并立即啟動(dòng)一個(gè)新實(shí)例。 ClickOnce部署
public static event ThreadExceptionEventHandler ThreadException //在發(fā)生未捕獲線程異常時(shí)發(fā)生。 未捕獲的異常,通過這個(gè)事件處理來打印日志
一般來說System.AppDomain的CurrentDomain的UnhandledException事件是需要注冊(cè)的System.Windows.Forms.Application的ThreadException事件也是需要注冊(cè)的通過上面兩個(gè)事件來捕獲未知的異常
最后吐槽下,博客園的markdown編輯器,不支持兩個(gè)空格和enter鍵換行嗎?
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注