コード例 #1
0
ファイル: SizeAdorner.cs プロジェクト: radtek/Shopdrawing
        public override void Draw(DrawingContext ctx, Matrix matrix)
        {
            if (!this.shouldDraw)
            {
                return;
            }
            bool  flag        = this.AdornerSet is RectangleGeometryAdornerSetBase;
            Point anchorPoint = this.GetAnchorPoint(matrix);
            Brush brush       = this.IsActive ? (flag ? FeedbackHelper.GetActiveBrush(AdornerType.ClipPath) : this.ActiveBrush) : this.InactiveBrush;
            Pen   pen         = flag ? FeedbackHelper.GetThinPen(AdornerType.ClipPath) : this.ThinPen;
            Rect  targetRect  = this.TargetRect;
            AdornerRenderLocation location = AdornerRenderLocation.Outside;

            if (this.DesignerContext.SelectionManager.ElementSelectionSet != null && this.DesignerContext.SelectionManager.ElementSelectionSet.Selection.Count > 1 && !this.ElementSet.AdornsMultipleElements)
            {
                location = AdornerRenderLocation.Inside;
            }
            SizeAdorner.DrawSizeAdorner(ctx, anchorPoint, this.EdgeFlags, matrix, brush, pen, targetRect, location);
            if (!this.IsActive)
            {
                return;
            }
            Matrix transformMatrix = this.ElementSet.GetTransformMatrix(this.DesignerContext.ActiveView.ViewRoot);

            SizeAdorner.DrawDimensions(ctx, matrix, transformMatrix, pen, targetRect, this.EdgeFlags);
        }
コード例 #2
0
        public override void Draw(DrawingContext ctx, Matrix matrix)
        {
            Point anchorPoint   = this.GetAnchorPoint(matrix);
            Brush brush         = this.IsActive ? this.ActiveBrush : this.InactiveBrush;
            Rect  elementBounds = this.ElementBounds;

            if (this.Type == DesignTimeAdornerType.Width || this.Type == DesignTimeAdornerType.Height)
            {
                if (!this.handlingDrag || this.IsActive || !this.IsEnabled)
                {
                    Pen thinPen = this.ThinPen;
                    this.DrawEdgeAdorner(ctx, anchorPoint, matrix, brush, thinPen, elementBounds);
                }
            }
            else
            {
                if (!this.TestFlags(EdgeFlags.BottomRight))
                {
                    throw new NotSupportedException();
                }
                Pen pen = this.IsEnabled ? this.MediumPen : this.ThinPen;
                this.DrawCornerAdorner(ctx, anchorPoint, matrix, brush, pen);
            }
            if (!this.IsActive || !this.IsEnabled)
            {
                return;
            }
            Matrix transformMatrix = this.ElementSet.GetTransformMatrix(this.DesignerContext.ActiveView.ViewRoot);

            SizeAdorner.DrawDimensions(ctx, matrix, transformMatrix, this.ThinPen, elementBounds, this.EdgeFlags);
        }