本文整理汇总了C#中Part.CanRotate方法的典型用法代码示例。如果您正苦于以下问题:C# Part.CanRotate方法的具体用法?C# Part.CanRotate怎么用?C# Part.CanRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.CanRotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAdornments
/// <summary>
/// Show an <see cref="Adornment"/> with a rotate handle at a point to the side of the <see cref="AdornedElement"/>,
/// if the node is selected and visible and if <see cref="Northwoods.GoXam.Part.CanRotate"/> is true.
/// </summary>
/// <param name="part"></param>
/// <remarks>
/// You can change the template used to create the adornment by setting <see cref="Part.RotateAdornmentTemplate"/>.
/// If that property is null, this uses a default template that produces a small circle.
/// </remarks>
public override void UpdateAdornments(Part part) {
if (part == null || part is Link) return; // this tool never applies to Links
Adornment adornment = null;
if (part.IsSelected) {
FrameworkElement selelt = part.SelectionElement;
if (selelt != null && part.CanRotate() && Part.IsVisibleElement(selelt)) {
adornment = part.GetAdornment(ToolCategory);
if (adornment == null) {
DataTemplate template = part.RotateAdornmentTemplate;
if (template == null) template = Diagram.FindDefault<DataTemplate>("DefaultRotateAdornmentTemplate");
adornment = part.MakeAdornment(selelt, template);
if (adornment != null) {
adornment.Category = ToolCategory;
adornment.LocationSpot = Spot.Center;
}
}
if (adornment != null) {
adornment.Location = part.GetElementPoint(selelt, new Spot(1, 0.5, 30, 0)); //?? fixed distance from middle right side
}
}
}
part.SetAdornment(ToolCategory, adornment);
}
示例2: UpdateAdornments
/// <summary>
/// Show an <see cref="Adornment"/> with a rotate handle at a point to the side of the <see cref="AdornedElement"/>,
/// if the node is selected and visible and if <see cref="Northwoods.GoXam.Part.CanRotate"/> is true.
/// </summary>
/// <param name="part"></param>
/// <remarks>
/// You can change the template used to create the adornment by setting <see cref="Part.RotateAdornmentTemplate"/>.
/// If that property is null, this uses a default template that produces a small circle.
/// </remarks>
public override void UpdateAdornments(Part part) {
if (part == null || part is Link) return; // this tool never applies to Links
Adornment adornment = null;
if (part.IsSelected) {
FrameworkElement selelt = part.SelectionElement;
if (selelt != null && part.CanRotate() && Part.IsVisibleElement(selelt)) {
adornment = part.GetAdornment(ToolCategory);
if (adornment == null) {
DataTemplate template = part.RotateAdornmentTemplate;
if (template == null) template = Diagram.FindDefault<DataTemplate>("DefaultRotateAdornmentTemplate");
adornment = part.MakeAdornment(selelt, template);
if (adornment != null) {
adornment.Category = ToolCategory;
adornment.LocationSpot = Spot.Center;
}
}
if (adornment != null) {
Rect rect = part.GetElementBounds(part.VisualElement); //?? outside whole node
Point center = Spot.Center.PointInRect(rect);
double angle = part.GetAngle(selelt);
adornment.Location = Geo.RotatePoint(new Point(rect.Right + 30, center.Y), center, angle); //?? fixed distance
}
}
}
part.SetAdornment(ToolCategory, adornment);
}