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


C# IDiagramPresenter.DrawShapeOutline方法代码示例

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


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

示例1: DrawConnectionTargets

		/// <summary>
		/// Draws all connection targets in range.
		/// </summary>
		protected void DrawConnectionTargets(IDiagramPresenter diagramPresenter, Shape shape, ControlPointId gluePtId, Point newGluePtPos, IEnumerable<Shape> excludedShapes) {
			if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");
			if (!Geometry.IsValid(newGluePtPos)) throw new ArgumentException("newGluePtPos");
			if (shape == null) throw new ArgumentNullException("shape");
			//if (gluePtId == ControlPointId.None || gluePtId == ControlPointId.Any)
			//   throw new ArgumentException(string.Format("{0} is not a valid {1} for this operation.", gluePtId, typeof(ControlPointId).Name));
			//if (!shape.HasControlPointCapability(gluePtId, ControlPointCapabilities.Glue))
			//   throw new ArgumentException(string.Format("{0} is not a valid glue point.", gluePtId));
			if (!diagramPresenter.Project.SecurityManager.IsGranted(Permission.Connect, shape))
				return;

			// Find connection target shape at the given position
			ShapeAtCursorInfo shapeAtCursor = ShapeAtCursorInfo.Empty;
			if (shape != null && gluePtId != ControlPointId.None)
				shapeAtCursor = FindConnectionTarget(diagramPresenter, shape, gluePtId, newGluePtPos, false, false);
			else shapeAtCursor = FindConnectionTargetFromPosition(diagramPresenter, newGluePtPos.X, newGluePtPos.Y, false, false);

			// Add shapes in range to the shapebuffer and then remove all excluded shapes
			shapeBuffer.Clear();
			shapeBuffer.AddRange(shapesInRange);
			foreach (Shape excludedShape in excludedShapes) {
				shapeBuffer.Remove(excludedShape);
				if (excludedShape == shapeAtCursor.Shape)
					shapeAtCursor.Clear();
			}

			// If there is no ControlPoint under the Cursor and the cursor is over a shape, draw the shape's outline
			if (!shapeAtCursor.IsEmpty && shapeAtCursor.ControlPointId == ControlPointId.Reference
				&& shapeAtCursor.Shape.ContainsPoint(newGluePtPos.X, newGluePtPos.Y)) {
				diagramPresenter.DrawShapeOutline(IndicatorDrawMode.Highlighted, shapeAtCursor.Shape);
			}

			// Draw all connectionPoints of all shapes in range (except the excluded ones, see above)
			diagramPresenter.ResetTransformation();
			try {
				for (int i = shapeBuffer.Count - 1; i >= 0; --i) {
					foreach (int ptId in shapeBuffer[i].GetControlPointIds(ControlPointCapabilities.Connect)) {
						IndicatorDrawMode drawMode = IndicatorDrawMode.Normal;
						if (shapeBuffer[i] == shapeAtCursor.Shape && ptId == shapeAtCursor.ControlPointId)
							drawMode = IndicatorDrawMode.Highlighted;
						diagramPresenter.DrawConnectionPoint(drawMode, shapeBuffer[i], ptId);
					}
				}
			} finally { diagramPresenter.RestoreTransformation(); }
		}
开发者ID:jestonitiro,项目名称:nshape,代码行数:48,代码来源:Tool.cs


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