Create a root shape node when loading the page
- Switch to the Default.aspx.cs file.
- Add an if statement for checking IsPostBack; if it is false (loading the page for the first time), the root shape node should be drawn as specified in the CreateShapeNode method of the Factory class.
- Add the following code to the Page_Load event-handler:
C#
Copy Code
|
---|
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Diagram diagram = diagView.Diagram; ShapeNode root = diagram.Factory.CreateShapeNode(10, 10, 24, 14); root.Shape = Shapes.RoundRect; root.Brush = new MindFusion.Drawing.SolidBrush(Color.White); root.Text = "root"; } } ... } |
In this source code, the Shape is specified as "RoundRect", a white SolidBrush assigned to the Brush, and the "root" Text should be displayed within the root shape node.
- Execute the Website application.
The default browser is opened and the root shape node is drawn on the page.