您好,登錄后才能下訂單哦!
這篇文章主要介紹“C#Windows應(yīng)用程序開發(fā)添加狀態(tài)條的方法”,在日常操作中,相信很多人在C#Windows應(yīng)用程序開發(fā)添加狀態(tài)條的方法問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”C#Windows應(yīng)用程序開發(fā)添加狀態(tài)條的方法”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
C#Windows應(yīng)用程序開發(fā)之添加狀態(tài)條前言:通常windows應(yīng)用程序都有相似的特征:控件、菜單、工具條、狀態(tài)欄等等。每次我們開始作一個(gè)新的windows應(yīng)用程序時(shí)都是以相同的事情開始:建立項(xiàng)目,添加控件和事件處理器。如果我們有一個(gè)模板,那么我們就可以節(jié)約大量的時(shí)間了。
在介紹如何建立模板的過(guò)程中,將涉及大量的微軟.net framework類庫(kù)的基本知識(shí)。如果你沒(méi)有使用集成開發(fā)環(huán)境那么本文介紹的模板對(duì)你將非常有用,如果你使用了visual studio.net這樣的集成開發(fā)環(huán)境你也可以從中了解控件的工作方式,這對(duì)你也是很有用的。
C#Windows應(yīng)用程序開發(fā)之添加狀態(tài)條的過(guò)程:
C#Windows應(yīng)用程序開發(fā)之添加狀態(tài)條由System.Windows.Forms.StatusBar描述,它提供了定制控件的外觀的屬性,狀態(tài)條由StatusBarPanel對(duì)象組成,在我們的模板中狀態(tài)條有兩個(gè)嵌套板:
StatusBar statusBar = new StatusBar(); StatusBarPanel statusBarPanel1 = new StatusBarPanel(); StatusBarPanel statusBarPanel2 = new StatusBarPanel();
C#Windows應(yīng)用程序開發(fā)之添加狀態(tài)條之狀態(tài)條和狀態(tài)跳上的嵌套板由下面的代碼設(shè)置:
statusBarPanel1.BorderStyle = StatusBarPanelBorderStyle.Sunken; statusBarPanel1.Text = "Press F1 for Help"; statusBarPanel1.AutoSize = StatusBarPanelAutoSize.Spring; statusBarPanel2.BorderStyle = StatusBarPanelBorderStyle.Raised; statusBarPanel2.ToolTipText = System.DateTime.Now.ToShortTimeString(); statusBarPanel2.Text = System.DateTime.Today.ToLongDateString(); statusBarPanel2.AutoSize = StatusBarPanelAutoSize.Contents; statusBar.ShowPanels = true; statusBar.Panels.Add(statusBarPanel1); statusBar.Panels.Add(statusBarPanel2);
C#Windows應(yīng)用程序開發(fā)之添加狀態(tài)條目的:我們需要將狀態(tài)條添加到窗體中:
this.Controls.Add(statusBar);
到此,關(guān)于“C#Windows應(yīng)用程序開發(fā)添加狀態(tài)條的方法”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。