DevExpress中Diagram中常用的一些方法

发布时间 2023-06-19 21:29:09作者: 东经115

1、Diagram中插入一个形状的方法:

DiagramShape diagramShape = new DiagramShape();//新建一个形状对象
diagramShape.Shape = DevExpress.Diagram.Core.BasicShapes.Rectangle;//赋值为一个基础图形:矩形
diagramShape.ConnectionPoints = new PointCollection(new List<PointFloat> { new PointFloat(0.5f, 0.5f) });//为形状设置连接点

//如果想进入用户绘制模式时
//方法1:
SelectedDiagram.Commands.Execute(DiagramCommands.SelectRectangleToolCommand);
//方法2:
BeginInvoke((Action)(() => SelectedDiagram.Commands.Execute(DiagramCommands.SelectRectangleToolCommand)));