本文整理汇总了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(); }
}