${mapping_ShapeBase_Title}

${mapping_ShapeBase_Description}

${mapping_ShapeBase_Remarks}
Наследование: Windows.UI.Xaml.Controls.UserControl
Пример #1
0
 internal void ResetShapeBaseTransform(ShapeElement sb)
 {
     if (((sb.OriginX != this.Origin.X) || (sb.OriginY != this.Origin.Y)) || (sb.Resolution != this.Resolution))
     {
         sb.InvalidatePath(this.Resolution, this.OriginX, this.OriginY);
     }
 }
 //对于SL自带的Rectangle暂不做处理
 private void SetClipShapeBase(ShapeElement sb, Rectangle2D clipBox, double resolution)
 {
     Rectangle2D bounds = sb.Point2Ds.GetBounds();
     if ((Rectangle2D.IsNullOrEmpty(bounds)) || ((bounds.Width / resolution) < 16383.5))
     {
         if (sb.ClippedPoint2Ds != null)
         {
             sb.ClearClip();
         }
     }
     else if (((Rectangle2D.IsNullOrEmpty(sb.ClipBox)) || !clipBox.Within(sb.ClipBox)) || ((sb.ClipBox.Width / resolution) >= 16383.5))
     {
         if (sb is PolygonElement)
         {
             sb.SetClip(new PolygonElementClip(clipBox).Clip(sb.Point2Ds), clipBox);
         }
         else if (sb is PolylineElement)
         {
             sb.SetClip(new PolylineElementClip(clipBox).Clip(sb.Point2Ds), clipBox);
         }
     }
 }
        private void ArrangeShapeBase(ShapeElement sb, Rectangle2D clipBox, Point2D origin, double resolution)
        {
            if (sb.Visibility != Visibility.Collapsed)
            {
                Rectangle2D b = GetBounds(sb);
                if (!Rectangle2D.IsNullOrEmpty(b))
                {
                    double x = (b.Left - origin.X) / resolution;
                    double y = (origin.Y - b.Top) / resolution;

                    if (((b.Width > 0.0) || (b.Height > 0.0)) && (sb.Point2Ds != null))
                    {
                        double ratio = sb.Resolution / resolution;
                        this.SetClipShapeBase(sb, clipBox, resolution);
                        if (sb.ClippedPoint2Ds != null)
                        {
                            b = sb.ClippedPoint2Ds.GetBounds();
                            if (Rectangle2D.IsNullOrEmpty(b))
                            {
                                return;
                            }
                            x = (b.Left - origin.X) / resolution;
                            y = (origin.Y - b.Top) / resolution;
                        }

                        if (sb.EncapsulatedShape.RenderTransform is ScaleTransform)
                        {
                            (sb.EncapsulatedShape.RenderTransform as ScaleTransform).ScaleX = (sb.EncapsulatedShape.RenderTransform as ScaleTransform).ScaleY = ratio;
                        }
                        else
                        {
                            sb.EncapsulatedShape.RenderTransform = new ScaleTransform { ScaleX = ratio, ScaleY = ratio };
                        }
                        double num4 = b.Width / sb.Resolution * ratio + 10.0;
                        double num5 = b.Height / sb.Resolution * ratio + 10.0;
                        num4 = Math.Min(32000.0, num4);
                        num5 = Math.Min(32000.0, num5);
                        sb.Arrange(new Rect(x, y, num4, num5));
                    }
                    else
                    {
                        sb.Arrange(new Rect(new Point(x, y), sb.DesiredSize));
                    }
                }
            }
        }