翻譯|使用教程|編輯:況魚杰|2019-07-25 15:10:05.780|閱讀 416 次
概述:本教程介紹在TX Text Control .NET for Windows Forms中如何創(chuàng)建功能區(qū)應(yīng)用程序:添加應(yīng)用程序菜單。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
TX Text Control .NET for Windows Forms 是一套功能豐富的文字處理控件,它以可重復(fù)使用控件的形式為開發(fā)人員提供了Word中常用的文字處理功能,對于需要強(qiáng)大且靈活的文檔處理能力的應(yīng)用程序而言,是理想的選擇。
點(diǎn)擊下載 TX Text Control .NET for Windows Forms X17試用版
本教程介紹如何創(chuàng)建TX Text Control .NET for Windows Forms的功能區(qū)應(yīng)用程序這部分教程將會分為三個(gè)部分,本章是第三部分,將會介紹添加應(yīng)用程序菜單的過程(點(diǎn)擊上、中可獲得前面的教程)。
在Solution Explorer中,選擇Form1表單,然后從View主菜單中選擇Designer。
選擇功能區(qū)控件,然后在Properties窗口中找到ApplicationMenuItems屬性。
單擊ApplicationMenuItems屬性的(Collection)值列中的省略號按鈕,打開Control Collection Editor。
在Control Collection Editor中,單擊Add以添加新的Windows.Forms.Ribbon.RibbonButton。將此按鈕命名為m_rbtnLoad,并將Text屬性設(shè)置為Load ....,將名為m_rbtnSave和Text Save ....添加為第二個(gè)按鈕,然后單擊OK關(guān)閉對話框。
在Solution Explorer中,選擇表單Form1并從View主菜單中選擇Code。將另外兩個(gè)事件附加到Form1構(gòu)造函數(shù)代碼,以便完整的構(gòu)造函數(shù)代碼如下所示:
cs:
public Form1() { InitializeComponent(); textControl1.InputPositionChanged += TextControl1_InputPositionChanged; textControl1.FrameSelected += TextControl1_FrameSelected; textControl1.FrameDeselected += TextControl1_FrameDeselected; textControl1.DrawingActivated += TextControl1_DrawingActivated; textControl1.DrawingDeselected += TextControl1_DrawingDeselected; m_rbtnLoad.Click += M_rbtnLoad_Click; m_rbtnSave.Click += M_rbtnSave_Click; }
vb:
Public Sub New() InitializeComponent() textControl1.InputPositionChanged += TextControl1_InputPositionChanged textControl1.FrameSelected += TextControl1_FrameSelected textControl1.FrameDeselected += TextControl1_FrameDeselected textControl1.DrawingActivated += TextControl1_DrawingActivated textControl1.DrawingDeselected += TextControl1_DrawingDeselected AddHandler m_rbtnLoad.Click, AddressOf M_rbtnLoad_Click AddHandler m_rbtnSave.Click, AddressOf M_rbtnSave_Click End Sub
在Form構(gòu)造函數(shù)代碼下,添加以下兩個(gè)新的事件處理程序方法:
cs:
private void M_rbtnSave_Click(object sender, EventArgs e) { textControl1.Save(); } private void M_rbtnLoad_Click(object sender, EventArgs e) { textControl1.Load(); }
vb:
Private Sub M_rbtnSave_Click(sender As Object, e As EventArgs) textControl1.Save() End Sub Private Sub M_rbtnLoad_Click(sender As Object, e As EventArgs) textControl1.Load() End Sub
構(gòu)建并啟動應(yīng)用程序。
單擊File應(yīng)用程序菜單時(shí),可以看到兩個(gè)菜單項(xiàng),用以加載和保存文檔。
創(chuàng)建TX Text Control .NET for Windows Forms功能區(qū)應(yīng)用程序的教程就到這里結(jié)束了,趕緊動手試試吧!下一節(jié)我們將會介紹如何創(chuàng)建第一個(gè)Windows窗體應(yīng)用程序,也希望持續(xù)關(guān)注我們的TX Text Control .NET系列教程。
想要了解更多有關(guān)慧都的資訊,請點(diǎn)擊,或者關(guān)注慧聚IT微信公眾號 ???
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: