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