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


C# Part.CanRotate方法代码示例

本文整理汇总了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);
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:32,代码来源:RotatingTool.cs

示例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);
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:35,代码来源:RotatingTool.cs


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