您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關.net framework中Windows Forms如何創建功能區應用程序,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
TX Text Control .NET for Windows Forms 是一套功能豐富的文字處理控件,它以可重復使用控件的形式為開發人員提供了Word中常用的文字處理功能,對于需要強大且靈活的文檔處理能力的應用程序而言,是理想的選擇。
點擊下載 TX Text Control .NET for Windows Forms X17試用版
在此步驟中,添加并連接用于表格和框架布局任務的上下文功能區選項卡
在表單上,通過單擊藍色File選項卡標題選擇功能區控件,以單擊功能區控件右上角的智能標記。單擊Quick Access Toolbar 將表單轉換為Windows.Forms.Ribbon.RibbonForm。
再次選擇功能區控件,方法是單擊藍色的 File 選項卡標題,然后在Properties 窗口中找到ContextualTabGroups屬性。
單擊ContextualTabGroups屬性的(Collection)值列中的省略號按鈕,打開ContextualTabGroup集合編輯器。
在Collection Editor中,單擊Add以添加新的Windows.Forms.Ribbon.ContextualTabGroup,將此組命名為m_grpTableTools,將Header屬性設置為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
構建并啟動應用程序。 使用Insert功能區選項卡中的Table插入表格。將輸入位置設置到表中以便上下文查看表工具選項卡。
看完上述內容,你們對.net framework中Windows Forms如何創建功能區應用程序有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。