原創|使用教程|編輯:郝浩|2013-05-14 10:15:29.000|閱讀 3764 次
概述:FlowChart.NET現在更名為MindFusion.Diagramming for WinForms,這個是一個通用的流程圖控件,提供了用于創建或編輯圖表的直觀的用戶交互模型。今天來看看里面的安排組件的使用。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
FlowChart.NET現在更名為MindFusion.Diagramming for WinForms,這個是一個通用的流程圖控件。MindFusion.Diagramming除WinForms版本外,還有WPF、ASP.NET MVC、Silverlight、JavaScript、Java Swing、Android、iOS Cocoa Touch等多種平臺的版本可選擇。FlowChart.NET提供了用于創建或編輯圖表的直觀的用戶交互模型,此外,還提供了功能強大的編程接口,包括了從打印、XML序列化到路徑查找、以及自動布局算法。今天來看看里面的安排組件的使用。
FlowChart.NET可以很容易的集成的任何的針對微軟.NET平臺的程序中。通過在你的軟件中使用可視化和編輯功能關系數據,FlowChart.NET可以節省大量的編碼和調試的時間。
可以實現以下強大功能:
在FlowChart.NET(MindFusion.Diagramming for WinForms)中,組件的使用是通過CompositeNode類的實例或是衍生自CompositeNode類的實例。只是需要創建一個具體的組件實例,并將它們添加到CompositeNode組件集。
安排的組件使用
在默認的情況下,復合節點將會在彼此的頂部安排它的子節點,它們被添加的組件集合。為了應用自定義安排,這個子節點使用相應的面板組件來按組件層次組織。比如說水平上安排子節點,成一排,就可以使用StackPanel,設置方向為水平,示例代碼如下:
C#
CompositeNode node = new CompositeNode(); StackPanel panel = new StackPanel(); panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal; panel.Spacing = 1; TextComponent text = new TextComponent(); text.Text = "Hello world!"; panel.Components.Add(text); ButtonComponent button = new ButtonComponent(); TextComponent buttonContent = new TextComponent(); buttonContent.Text = "Click me!"; button.Content = buttonContent; panel.Components.Add(button); node.Components.Add(panel);
Visual Basic
Dim node As New CompositeNode() Dim panel As New StackPanel() panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal panel.Spacing = 1 Dim text As New TextComponent() text.Text = "Hello world!" panel.Components.Add(text) Dim button As New ButtonComponent() Dim buttonContent As New TextComponent() buttonContent.Text = "Click me!" button.Content = buttonContent panel.Components.Add(button) node.Components.Add(panel)
還可以自定義面板類,可以通過從ContentComponent派生和重寫ArrangeComponents方法。另一種方式來安排子組件,就是從CompositeNode派生和重寫ArrangeComponents方法,然后可以通過它們的Bounds屬性手動的指定單個節點的位置。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件