Search
Layout.Progress Property
See Also
 





Gets or sets a delegate, which is invoked regularly during the layout process to inform clients about the layout progress.

Namespace: MindFusion.Diagramming.Layout
Package: MindFusion.Diagramming

 Syntax

C#  Copy Code

public virtual LayoutProgress Progress { get; set; }

Visual Basic  Copy Code

Public Overridable Property Progress As LayoutProgress

 Property Value

A LayoutProgress delegate method to call while the algorithm proceeds.

 Remarks

It might take a lot of time to arrange large diagrams or run more iterations of the algorithm to get better results. In such situations an application can be notified about the progress of the layout routine by assigning a delegate method  to this property. On its turn the application could update the UI to indicate the current progress to the users.

 Example

The following example updates a label text to indicate the progress of a layout algorithm. The CreateLayout method instantiates a layout object from a concrete class.

C#  Copy Code

Layout layout = CreateLayout();
layout.Progress = new LayoutProgress(onProgress);
layout.Arrange(diagram);

// ...

void onProgress(int c, int n)
{
    label1.Text = (100*c/n).ToString() + "% complete";
    label1.Refresh();
}

Visual Basic  Copy Code

Dim layout As Layout = CreateLayout()
layout.Progress = New LayoutProgress(AddressOf onProgress)
layout.Arrange(diagram)

' ...

Sub onProgress(ByVal c As Integer, ByVal n As Integer)

    label1.Text = (100 * c / n).ToString() + "% complete"
    label1.Refresh()

End Sub

 See Also