您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān).net framework中Windows Forms如何創(chuàng)建功能區(qū)應(yīng)用程序,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
TX Text Control .NET for Windows Forms 是一套功能豐富的文字處理控件,它以可重復(fù)使用控件的形式為開發(fā)人員提供了Word中常用的文字處理功能,對(duì)于需要強(qiáng)大且靈活的文檔處理能力的應(yīng)用程序而言,是理想的選擇。
點(diǎn)擊下載 TX Text Control .NET for Windows Forms X17試用版
在此步驟中,添加并連接用于表格和框架布局任務(wù)的上下文功能區(qū)選項(xiàng)卡
在表單上,通過單擊藍(lán)色File選項(xiàng)卡標(biāo)題選擇功能區(qū)控件,以單擊功能區(qū)控件右上角的智能標(biāo)記。單擊Quick Access Toolbar 將表單轉(zhuǎn)換為Windows.Forms.Ribbon.RibbonForm。
再次選擇功能區(qū)控件,方法是單擊藍(lán)色的 File 選項(xiàng)卡標(biāo)題,然后在Properties 窗口中找到ContextualTabGroups屬性。
單擊ContextualTabGroups屬性的(Collection)值列中的省略號(hào)按鈕,打開ContextualTabGroup集合編輯器。
在Collection Editor中,單擊Add以添加新的Windows.Forms.Ribbon.ContextualTabGroup,將此組命名為m_grpTableTools,將Header屬性設(shè)置為Table Tools并選擇BackColor。
在 Solution Explore中,選擇表單Form1并從View主菜單中選擇Code。添加以下代碼,完整的Form1類代碼如下所示:
代碼-cs
public partial class Form1 : TXTextControl.Windows.Forms.Ribbon.RibbonForm { public Form1() { InitializeComponent(); textControl1.InputPositionChanged += TextControl1_InputPositionChanged; textControl1.FrameSelected += TextControl1_FrameSelected; textControl1.FrameDeselected += TextControl1_FrameDeselected; textControl1.DrawingActivated += TextControl1_DrawingActivated; textControl1.DrawingDeselected += TextControl1_DrawingDeselected; } private void TextControl1_DrawingDeselected(object sender, TXTextControl.DataVisualization.DrawingEventArgs e) { if ((textControl1.Frames.GetItem() == null) && (textControl1.Drawings.GetActivatedItem() == null)) { m_grpFrameTools.Visible = false; } } private void TextControl1_DrawingActivated(object sender, TXTextControl.DataVisualization.DrawingEventArgs e) { m_grpFrameTools.Visible = true; } private void TextControl1_FrameDeselected(object sender, TXTextControl.FrameEventArgs e) { if ((textControl1.Frames.GetItem() == null) && (textControl1.Drawings.GetActivatedItem() == null)) { m_grpFrameTools.Visible = false; } } private void TextControl1_FrameSelected(object sender, TXTextControl.FrameEventArgs e) { m_grpFrameTools.Visible = true; } private void TextControl1_InputPositionChanged(object sender, EventArgs e) { m_grpTableTools.Visible = textControl1.Tables.GetItem() != null; } }
代碼-vb
Public Partial Class Form1 Inherits TXTextControl.Windows.Forms.Ribbon.RibbonForm Public Sub New() InitializeComponent() AddHandler textControl1.InputPositionChanged, AddressOf TextControl1_InputPositionChanged AddHandler textControl1.FrameSelected, AddressOf TextControl1_FrameSelected AddHandler textControl1.FrameDeselected, AddressOf TextControl1_FrameDeselected AddHandler textControl1.DrawingActivated, AddressOf TextControl1_DrawingActivated AddHandler textControl1.DrawingDeselected, AddressOf TextControl1_DrawingDeselected End Sub Private Sub TextControl1_DrawingDeselected(sender As Object, e As TXTextControl.DataVisualization.DrawingEventArgs) If (textControl1.Frames.GetItem() Is Nothing) AndAlso (textControl1.Drawings.GetActivatedItem() Is Nothing) Then m_grpFrameTools.Visible = False End If End Sub Private Sub TextControl1_DrawingActivated(sender As Object, e As TXTextControl.DataVisualization.DrawingEventArgs) m_grpFrameTools.Visible = True End Sub Private Sub TextControl1_FrameDeselected(sender As Object, e As TXTextControl.FrameEventArgs) If (textControl1.Frames.GetItem() Is Nothing) AndAlso (textControl1.Drawings.GetActivatedItem() Is Nothing) Then m_grpFrameTools.Visible = False End If End Sub Private Sub TextControl1_FrameSelected(sender As Object, e As TXTextControl.FrameEventArgs) m_grpFrameTools.Visible = True End Sub Private Sub TextControl1_InputPositionChanged(sender As Object, e As EventArgs) m_grpTableTools.Visible = textControl1.Tables.GetItem() IsNot Nothing End Sub End Class
構(gòu)建并啟動(dòng)應(yīng)用程序。 使用Insert功能區(qū)選項(xiàng)卡中的Table插入表格。將輸入位置設(shè)置到表中以便上下文查看表工具選項(xiàng)卡。
看完上述內(nèi)容,你們對(duì).net framework中Windows Forms如何創(chuàng)建功能區(qū)應(yīng)用程序有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。