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


C# IShape.GetCenter方法代码示例

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


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

示例1: Subject_ChangedForm

 void Subject_ChangedForm(IShape subject, ChangeFormState state)
 {
     if (isAttracted || dragged != subject || !state.HasFlag(ChangeFormState.Coords)) return;
     using (StartFinishAction.Create(() => isAttracted = true, () => isAttracted = false))
     {
         RectangleF rect = subject.Rectangle;
         PointF center = subject.GetCenter(), minDist = new PointF(10, 10), dist = new PointF();
         guidlines = subject.GetCenter();
         hit = 0;
         bool lHit = false;
         foreach (var guide in guides.Where(s => s != subject).Select(s => s.GetCenter()))
         {
             if ((dist.X = Math.Abs(center.X - guide.X)) < minDist.X)
             {
                 minDist.X = dist.X;
                 guidlines.X = guide.X;
                 hit |= 1;
             }
             if ((dist.Y = Math.Abs(center.Y - guide.Y)) < minDist.Y)
             {
                 minDist.Y = dist.Y;
                 guidlines.Y = guide.Y;
                 hit |= 2;
             }
             if (hit == 3) break;
             //if (hit = Math.Abs(rect.Left - guide.X) <= 10)
             //    subject.Left = guide.X;
             //if (hit |= Math.Abs(rect.Top - guide.Y) <= 10)
             //    subject.Top = guide.Y;
             //if (hit) break;
         }
         subject.ToCenterPoint(guidlines);
     }
 }
开发者ID:Basilid,项目名称:Spheres,代码行数:34,代码来源:GuideLine.cs

示例2: marker_ChangedForm

 void marker_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (!isMarkerChangedForm && state.HasFlag(ChangeFormState.Coords))
         using (StartFinishAction.Create(() => isMarkerChangedForm = true, () => isMarkerChangedForm = false))
         {
             var ind = Markers.IndexOf((ReactiveShape<Circle>)obj);
             Filler.Shape[ind] = obj.GetCenter();
             obj.ToCenterPoint(Filler.Shape[ind]);
             //Caption.Shape.String = Filler.Shape.Area.ToString("R");
             FitchInfoPics();
         }
     //Caption.ToCenterPoint(Filler.GetCenter());
 }
开发者ID:Basilid,项目名称:Spheres,代码行数:13,代码来源:ModuleConstructor.cs


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