为什么Geometry.Bounds没有正确改变?

时间:2016-11-22 10:58:58

标签: c# xaml uwp uwp-xaml

我正在与UWP合作并遇到此问题。我尝试操纵LineGeometry。当我通过TranslateTransform.TransformPoint()更改StartPoint或EndPoint时,我的线被一些矩形切割。我认为这是Bounds的一部分,但有可能改变它或做些什么来修复它吗?

绘制紫点的部分

Path ellipsePoint = new Path();
ellipsePoint.Stroke = new SolidColorBrush(Colors.BlueViolet);
ellipsePoint.StrokeThickness = 3;
ellipsePoint.Fill = new SolidColorBrush(Colors.DarkViolet);
var geometry = new EllipseGeometry();
geometry.Center = point;
geometry.Transform = CompositeTransform;
geometry.RadiusX = geometry.RadiusY = 15;
ellipsePoint.Tag = isStartPoint;
ellipsePoint.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
var dragTranslation = new TranslateTransform();
ellipsePoint.RenderTransform = dragTranslation;
ellipsePoint.ManipulationDelta +=
     (s, e) =>
     {
         dragTranslation.X += e.Delta.Translation.X;
         dragTranslation.Y += e.Delta.Translation.Y;
         var manPoint = s as Path;
         if (manPoint != null)
             if ((bool)manPoint.Tag)
                 Line.StartPoint = dragTranslation.TransformPoint(point);
             else
                 Line.EndPoint = dragTranslation.TransformPoint(point);
      };
ellipsePoint.Data = geometry;`

如下所示准备

Line = new LineGeometry();
Line.StartPoint = _Points.First();
Line.EndPoint = _Points.Last();

Screenshot

0 个答案:

没有答案