当前位置: 首页>>代码示例>>C#>>正文


C# IDiagramPresenter.InsertShape方法代码示例

本文整理汇总了C#中IDiagramPresenter.InsertShape方法的典型用法代码示例。如果您正苦于以下问题:C# IDiagramPresenter.InsertShape方法的具体用法?C# IDiagramPresenter.InsertShape怎么用?C# IDiagramPresenter.InsertShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDiagramPresenter的用法示例。


在下文中一共展示了IDiagramPresenter.InsertShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareConnection

		private bool PrepareConnection(IDiagramPresenter diagramPresenter, MouseState mouseState,
		                               ShapeAtCursorInfo shapeAtCursorInfo, Action action)
		{
			// if we're not dealing with filter shapes... well, what the fuck?! get out of here!
			FilterSetupShapeBase shape = shapeAtCursorInfo.Shape as FilterSetupShapeBase;
			if (shape == null)
				throw new Exception("Can't connect a shape that isn't a FilterSetup shape!");

			if (shape.OutputCount <= 0)
				return false;

			// get the starting control point for the line; ie. the first unused output for the shape, or the selected control point (if the mouse is over an output)
			ControlPointId connectionPoint = ControlPointId.None;

			if (shapeAtCursorInfo.IsCursorAtConnectionPoint &&
			    shape.GetTypeForControlPoint(shapeAtCursorInfo.ControlPointId) ==
			    FilterSetupShapeBase.FilterShapeControlPointType.Output) {
				connectionPoint = shapeAtCursorInfo.ControlPointId;
			}
			else {
				// try and find the first unconnected output if the mouse isn't over a specific control point
				for (int i = 0; i < shape.OutputCount; i++) {
					ControlPointId currentPoint = shape.GetControlPointIdForOutput(i);
					if (shape.GetConnectionInfos(currentPoint, null).Count() == 0) {
						connectionPoint = currentPoint;
						break;
					}
				}

				// if we couldn't find an unconnected point, just default to the first
				if (connectionPoint == ControlPointId.None) {
					connectionPoint = shape.GetControlPointIdForOutput(0);
				}
			}

			DataFlowConnectionLine line =
				(DataFlowConnectionLine) diagramPresenter.Project.ShapeTypes["DataFlowConnectionLine"].CreateInstance();
			diagramPresenter.InsertShape(line);
			diagramPresenter.Diagram.Shapes.SetZOrder(line, 100);
			line.SecurityDomainName = ConfigFiltersAndPatching.SECURITY_DOMAIN_MOVABLE_SHAPE_WITH_CONNECTIONS;
			line.EndCapStyle = diagramPresenter.Project.Design.CapStyles.ClosedArrow;
			line.SourceDataFlowComponentReference = new DataFlowComponentReference(shape.DataFlowComponent,
			                                                                       shape.GetOutputNumberForControlPoint(
			                                                                       	connectionPoint));
			line.DestinationDataComponent = null;

			line.Connect(ControlPointId.FirstVertex, shape, connectionPoint);
			line.Disconnect(ControlPointId.LastVertex);
			line.MoveControlPointTo(ControlPointId.LastVertex, mouseState.X, mouseState.Y, ResizeModifiers.None);
			currentConnectionLine = line;

			StartToolAction(diagramPresenter, (int) action, ActionStartMouseState, true);
			return true;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:54,代码来源:ConfigFiltersAndPatching-Tools.cs


注:本文中的IDiagramPresenter.InsertShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。