當前位置: 首頁>>代碼示例>>C#>>正文


C# IShape.ToCenterPoint方法代碼示例

本文整理匯總了C#中IShape.ToCenterPoint方法的典型用法代碼示例。如果您正苦於以下問題:C# IShape.ToCenterPoint方法的具體用法?C# IShape.ToCenterPoint怎麽用?C# IShape.ToCenterPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IShape的用法示例。


在下文中一共展示了IShape.ToCenterPoint方法的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.ToCenterPoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。