今天就跟大家聊聊有关.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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。