原創(chuàng)|使用教程|編輯:郝浩|2013-06-05 10:24:58.000|閱讀 464 次
概述:業(yè)務(wù)流程圖控件FlowChart.NET是一個(gè)通用的流程圖控件,提供了用于創(chuàng)建或編輯圖表的直觀的用戶交互模型。在前面的文章中已經(jīng)講解了一些創(chuàng)建自定義節(jié)點(diǎn)類型的步驟,本教程將繼續(xù)展示在FlowChart.NET如何創(chuàng)建自定義節(jié)點(diǎn)類型的步驟。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
業(yè)務(wù)流程圖控件FlowChart.NET是一個(gè)通用的流程圖控件,提供了用于創(chuàng)建或編輯圖表的直觀的用戶交互模型。在前面的文章中已經(jīng)講解了一些創(chuàng)建自定義節(jié)點(diǎn)類型的步驟,本教程將繼續(xù)展示在FlowChart.NET如何創(chuàng)建自定義節(jié)點(diǎn)類型的步驟。
C#
protected override void SaveTo( System.IO.BinaryWriter writer, PersistContext ctx) { base.SaveTo(writer, ctx); // Save the label using the standard .NET BinaryWriter writer.Write(label); // Save the image using the MindFusion.Diagramming built-in image saving code, // which stores the contents of shared images only once. ctx.SaveImage(icon); } protected override void LoadFrom( System.IO.BinaryReader reader, PersistContext ctx) { base.LoadFrom(reader, ctx); label = reader.ReadString(); icon = ctx.LoadImage(); }
Visual Basic
Protected Overrides Sub SaveTo( _ ByVal writer As System.IO.BinaryWriter, ByVal ctx As PersistContext) MyBase.SaveTo(writer, ctx) ' Save the label using the standard .NET BinaryWriter writer.Write(fLabel) ' Save the image using the MindFusion.Diagramming built-in image saving code, ' which stores the contents of shared images only once. ctx.SaveImage(fIcon) End Sub Protected Overrides Sub LoadFrom( _ ByVal reader As System.IO.BinaryReader, ByVal ctx As PersistContext) MyBase.LoadFrom(reader, ctx) fLabel = reader.ReadString() fIcon = ctx.LoadImage() End Sub
要啟用IconNode對(duì)象的交互繪圖,在InitializeComponent調(diào)用之后添加下面的代碼:
C#
// Let users draw IconNode objects
diagramView.CustomNodeType = typeof(IconNode);
diagramView.Behavior = Behavior.Custom;
Visual Basic
Let users draw IconNode objects
diagramView.CustomNodeType = GetType(IconNode)
diagramView.Behavior = Behavior.Custom
如上面一樣設(shè)置CustomNodeType和Behavior,來(lái)當(dāng)用戶在畫布上繪制圖表時(shí),指定創(chuàng)建IconNode實(shí)例。
C#
private void diagram_Clicked(object sender, DiagramEventArgs e)
{
IconNode iconNode = new IconNode(diagram);
diagram.Nodes.Add(iconNode);
iconNode.Move(e.MousePosition.X, e.MousePosition.Y);
}
Visual Basic
Private Sub diagram_Clicked(ByVal sender As Object, ByVal e As DiagramEventArgs) Handles diagram.Clicked
Dim iconNode As IconNode = New IconNode(diagram)
diagram.Nodes.Add(iconNode)
iconNode.Move(e.MousePosition.X, e.MousePosition.Y)
End Sub
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件