日期:2014-05-18 浏览次数:21673 次
void sample() { //流程图样式 addFlow1.Dock = DockStyle.Fill; addFlow1.AutoScroll = true; addFlow1.BackColor = SystemColors.Window; addFlow1.PageUnit = GraphicsUnit.Point; addFlow1.Grid.Draw = true; addFlow1.Grid.Snap = true; addFlow1.Grid.Style = GridStyle.Pixels; addFlow1.Grid.Color = Color.Silver; //节点阴影 addFlow1.DefNodeProp.Shadow.Style = ShadowStyle.RightBottom; addFlow1.DefNodeProp.Shadow.Color = Color.Silver; addFlow1.DefNodeProp.Shadow.Size = new Size(4, 4); //线条样式 addFlow1.DefLinkProp.Line.RoundedCorner = true; addFlow1.DefLinkProp.ArrowDst.Style = ArrowStyle.Arrow; addFlow1.DefLinkProp.ArrowDst.Angle = ArrowAngle.deg45; addFlow1.DefLinkProp.ArrowMid.Angle = ArrowAngle.deg45; addFlow1.DefLinkProp.BackMode = BackMode.Transparent; //addFlow1.DefLinkProp.Shadow.Style = ShadowStyle.RightBottom; //addFlow1.DefLinkProp.Shadow.Color = Color.Silver; //addFlow1.DefLinkProp.Shadow.Size = new Size(4, 4); addFlow1.BeginUpdate(); // 开始添加节点、线等控件 Node node0 = addFlow1.Nodes.Add(60, 48, 112, 32); node0.Text = "开始"; node0.Shape.Style = ShapeStyle.AlternateProcess; node0.FillColor = Color.LightYellow; Node node1 = addFlow1.Nodes.Add(76, 112, 80, 32); node1.Text = "自动判断?"; node1.Shape.Style = ShapeStyle.Losange; Node node2 = addFlow1.Nodes.Add(60, 186, 112, 48); node2.Text = "跳过步骤?"; node2.Shape.Style = ShapeStyle.Decision; Node node3 = addFlow1.Nodes.Add(60, 276, 112, 48); node3.Text = "再判断"; node3.Shape.Style = ShapeStyle.Losange; Node node4 = addFlow1.Nodes.Add(60, 366, 112, 48); node4.Text = "处理步骤" + "\r\n" + "步骤1" + "\r\n" + "..." + "\r\n" + "步骤5"; node4.Shape.Style = ShapeStyle.Rectangle; Node node5 = addFlow1.Nodes.Add(220, 112, 80, 32, "结束1"); node5.Shape.Style = ShapeStyle.Termination; Node node6 = addFlow1.Nodes.Add(220, 286, 80, 32, "结束2"); node6.Shape.Style = ShapeStyle.Termination; Node node7 = addFlow1.Nodes.Add(74, 460, 80, 32, "结束3"); node7.Shape.Style = ShapeStyle.Termination; //线 node0.OutLinks.Add(node1); node1.OutLinks.Add(node2, "no"); node2.OutLinks.Add(node3, "no"); node3.OutLinks.Add(node4, "yes"); node1.OutLinks.Add(node5, "yes"); node3.OutLinks.Add(node6, "no"); Link link = node2.OutLinks.Add(node4, "yes"); link.Line = new Line(LineStyle.HVH, false, true); link.Points[1] = new PointF(16, 210); link.Points[2] = new PointF(16, 390); node4.OutLinks.Add(node7, "end"); addFlow1.EndUpdate(); }