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


C# PathFigure.Freeze方法代码示例

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


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

示例1: InsertionAdorner

        // Create the pen and triangle in a static constructor and freeze them to improve performance.
        static InsertionAdorner()
        {
            pen = new Pen
            {
                Brush = Brushes.Gray,
                Thickness = 2
            };
            pen.Freeze();

            LineSegment firstLine = new LineSegment(new Point(0, -5), false);
            firstLine.Freeze();
            LineSegment secondLine = new LineSegment(new Point(0, 5), false);
            secondLine.Freeze();

            PathFigure figure = new PathFigure
            {
                StartPoint = new Point(5, 0)
            };
            figure.Segments.Add(firstLine);
            figure.Segments.Add(secondLine);
            figure.Freeze();

            triangle = new PathGeometry();
            triangle.Figures.Add(figure);
            triangle.Freeze();
        }
开发者ID:Boddlnagg,项目名称:WordsLive,代码行数:27,代码来源:InsertionAdorner.cs

示例2: CreateSplineSegment

        PathGeometry CreateSplineSegment(PointCollection points)
            {
            if (points == null || points.Count < 1)
                return null;

            PathGeometry    pathGeometry    = new PathGeometry();
            PathFigure      pathFigure      = new PathFigure();
            PolyLineSegment polyLineSegment = new PolyLineSegment();

            pathFigure.IsClosed = false;
            pathFigure.IsFilled = false;

            pathFigure.StartPoint = points[0];
            for (int i = 1; i < points.Count; i++)
                { 
                polyLineSegment.Points.Add(points[i]);
                }

            pathFigure.Segments.Add(polyLineSegment);
            pathGeometry.Figures.Add(pathFigure);
            //
            pathFigure.Freeze();
            //
            return pathGeometry;
            }
开发者ID:rgatkinson,项目名称:nadir,代码行数:25,代码来源:CanonicalSpline.cs

示例3: InsertionAdorner

 /// <summary>
 /// Create the pen and triangle in a static constructor and freeze them to improve performance.
 /// </summary>
 static InsertionAdorner()
 {
     Pen = new Pen { Brush = Brushes.SkyBlue, Thickness = LineThickness };
     Pen.Freeze();
     var firstLine = new LineSegment(new Point(0, -TriangleWidth), false);
     firstLine.Freeze();
     var secondLine = new LineSegment(new Point(0, TriangleWidth), false);
     secondLine.Freeze();
     var figure = new PathFigure {StartPoint = new Point(TriangleWidth, 0)};
     figure.Segments.Add(firstLine);
     figure.Segments.Add(secondLine);
     figure.Freeze();
     Triangle = new PathGeometry();
     Triangle.Figures.Add(figure);
     Triangle.Freeze();
 }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:19,代码来源:InsertionAdorner.cs

示例4: InsertionAdorner

 static InsertionAdorner()
 {
     InsertionAdorner.pen.Freeze();
       LineSegment lineSegment1 = new LineSegment(new Point(0.0, -5.0), false);
       lineSegment1.Freeze();
       LineSegment lineSegment2 = new LineSegment(new Point(0.0, 5.0), false);
       lineSegment2.Freeze();
       PathFigure pathFigure = new PathFigure()
       {
     StartPoint = new Point(5.0, 0.0)
       };
       pathFigure.Segments.Add((PathSegment) lineSegment1);
       pathFigure.Segments.Add((PathSegment) lineSegment2);
       pathFigure.Freeze();
       InsertionAdorner.triangle = new PathGeometry();
       InsertionAdorner.triangle.Figures.Add(pathFigure);
       InsertionAdorner.triangle.Freeze();
 }
开发者ID:sulerzh,项目名称:wpfext,代码行数:18,代码来源:InsertionAdorner.cs

示例5: InsertionAdorner

        /// <summary>
        /// Initializes static members of the <see cref="InsertionAdorner" /> class.
        /// </summary>
        static InsertionAdorner()
        {
            // Create the pen and triangle in a static constructor and freeze them to improve performance.
            Pen = new Pen { Brush = Brushes.Gray, Thickness = 2 };
            Pen.Freeze();

            var firstLine = new LineSegment(new Point(0, -5), false);
            firstLine.Freeze();
            var secondLine = new LineSegment(new Point(0, 5), false);
            secondLine.Freeze();

            var figure = new PathFigure { StartPoint = new Point(5, 0) };
            figure.Segments.Add(firstLine);
            figure.Segments.Add(secondLine);
            figure.Freeze();

            Triangle = new PathGeometry();
            Triangle.Figures.Add(figure);
            Triangle.Freeze();
        }
开发者ID:hasol81,项目名称:PropertyTools,代码行数:23,代码来源:InsertionAdorner.cs

示例6: DropTargetInsertionAdorner

        static DropTargetInsertionAdorner()
        {
            // Create the pen and triangle in a static constructor and freeze them to improve performance.
            const int triangleSize = 3;

            m_Pen = new Pen(Brushes.Gray, 2);
            m_Pen.Freeze();

            LineSegment firstLine = new LineSegment(new Point(0, -triangleSize), false);
            firstLine.Freeze();
            LineSegment secondLine = new LineSegment(new Point(0, triangleSize), false);
            secondLine.Freeze();

            PathFigure figure = new PathFigure { StartPoint = new Point(triangleSize, 0) };
            figure.Segments.Add(firstLine);
            figure.Segments.Add(secondLine);
            figure.Freeze();

            m_Triangle = new PathGeometry();
            m_Triangle.Figures.Add(figure);
            m_Triangle.Freeze();
        }
开发者ID:AugustinasNomicas,项目名称:MultitrackPlayer,代码行数:22,代码来源:DropTargetInsertionAdorner.cs

示例7: DropTargetMetroInsertionAdorner

        static DropTargetMetroInsertionAdorner()
        {
            // Create the pen and triangle in a static constructor and freeze them to improve performance.
            const int triangleSize = 5;

            var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
            m_Pen = new Pen(new SolidColorBrush(color), 2);
            m_Pen.Freeze();

            var firstLine = new LineSegment(new Point(0, -triangleSize), false);
            firstLine.Freeze();
            var secondLine = new LineSegment(new Point(0, triangleSize), false);
            secondLine.Freeze();

            var figure = new PathFigure {StartPoint = new Point(triangleSize, 0)};
            figure.Segments.Add(firstLine);
            figure.Segments.Add(secondLine);
            figure.Freeze();

            m_Triangle = new PathGeometry();
            m_Triangle.Figures.Add(figure);
            m_Triangle.Freeze();
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:23,代码来源:DropTargetMetroInsertionAdorner.cs

示例8: RenderAeroNormalColor

        private void RenderAeroNormalColor(DrawingContext dc)
        {
            Size size = RenderSize;
            bool horizontal = Orientation == Orientation.Horizontal;
            bool isClickable = IsClickable && IsEnabled;
            bool isHovered = isClickable && IsHovered;
            bool isPressed = isClickable && IsPressed;
            ListSortDirection? sortDirection = SortDirection;
            bool isSorted = sortDirection != null;
            bool isSelected = IsSelected;
            bool hasBevel = (!isHovered && !isPressed && !isSorted && !isSelected);

            EnsureCache((int)AeroFreezables.NumFreezables);

            if (horizontal)
            {
                // When horizontal, rotate the rendering by -90 degrees
                Matrix m1 = new Matrix();
                m1.RotateAt(-90.0, 0.0, 0.0);
                Matrix m2 = new Matrix();
                m2.Translate(0.0, size.Height);

                MatrixTransform horizontalRotate = new MatrixTransform(m1 * m2);
                horizontalRotate.Freeze();
                dc.PushTransform(horizontalRotate);

                double temp = size.Width;
                size.Width = size.Height;
                size.Height = temp;
            }

            if (hasBevel)
            {
                // This is a highlight that can be drawn by just filling the background with the color.
                // It will be seen through the gab between the border and the background.
                LinearGradientBrush bevel = (LinearGradientBrush)GetCachedFreezable((int)AeroFreezables.NormalBevel);
                if (bevel == null)
                {
                    bevel = new LinearGradientBrush();
                    bevel.StartPoint = new Point();
                    bevel.EndPoint = new Point(0.0, 1.0);
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.0));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.4));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFC, 0xFC, 0xFD), 0.4));
                    bevel.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFB, 0xFC, 0xFC), 1.0));
                    bevel.Freeze();

                    CacheFreezable(bevel, (int)AeroFreezables.NormalBevel);
                }

                dc.DrawRectangle(bevel, null, new Rect(0.0, 0.0, size.Width, size.Height));
            }

            // Fill the background
            AeroFreezables backgroundType = AeroFreezables.NormalBackground;
            if (isPressed)
            {
                backgroundType = AeroFreezables.PressedBackground;
            }
            else if (isHovered)
            {
                backgroundType = AeroFreezables.HoveredBackground;
            }
            else if (isSorted || isSelected)
            {
                backgroundType = AeroFreezables.SortedBackground;
            }

            LinearGradientBrush background = (LinearGradientBrush)GetCachedFreezable((int)backgroundType);
            if (background == null)
            {
                background = new LinearGradientBrush();
                background.StartPoint = new Point();
                background.EndPoint = new Point(0.0, 1.0);

                switch (backgroundType)
                {
                    case AeroFreezables.NormalBackground:
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.0));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF7, 0xF8, 0xFA), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF1, 0xF2, 0xF4), 1.0));
                        break;

                    case AeroFreezables.PressedBackground:
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBC, 0xE4, 0xF9), 0.0));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBC, 0xE4, 0xF9), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x8D, 0xD6, 0xF7), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0x8A, 0xD1, 0xF5), 1.0));
                        break;

                    case AeroFreezables.HoveredBackground:
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE3, 0xF7, 0xFF), 0.0));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xE3, 0xF7, 0xFF), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xBD, 0xED, 0xFF), 0.4));
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xB7, 0xE7, 0xFB), 1.0));
                        break;

                    case AeroFreezables.SortedBackground:
                        background.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0xF2, 0xF9, 0xFC), 0.0));
//.........这里部分代码省略.........
开发者ID:pusp,项目名称:o2platform,代码行数:101,代码来源:DataGridHeaderBorder.cs

示例9: OnRender


//.........这里部分代码省略.........
                double bottomWidth = guidelineSetX[4] - guidelineSetX[3];
                if (bottomWidth > 0)
                {
                    Rect bottom = new Rect(guidelineSetX[3], guidelineSetY[5], bottomWidth, ShadowDepth);
                    drawingContext.DrawRectangle(brushes[Bottom], null, bottom);
                }

                Rect bottomRight = new Rect(guidelineSetX[4], guidelineSetY[4], cornerRadius.BottomRight, cornerRadius.BottomRight);
                drawingContext.DrawRectangle(brushes[BottomRight], null, bottomRight);


                // Fill Center

                // Because the heights of the top/bottom rects and widths of the left/right rects are fixed
                // and the corner rects are drawn with the size of the corner, the center 
                // may not be a square.  In this case, create a path to fill the area

                // When the target object's corner radius is 0, only need to draw one rect
                if (cornerRadius.TopLeft == ShadowDepth &&
                    cornerRadius.TopLeft == cornerRadius.TopRight &&
                    cornerRadius.TopLeft == cornerRadius.BottomLeft &&
                    cornerRadius.TopLeft == cornerRadius.BottomRight)
                {
                    // All corners of target are 0, render one large rectangle
                    Rect center = new Rect(guidelineSetX[0], guidelineSetY[0], centerWidth, centerHeight);
                    drawingContext.DrawRectangle(brushes[Center], null, center);
                }
                else
                {
                    // If the corner radius is TL=2, TR=1, BL=0, BR=2 the following shows the shape that needs to be created.
                    //             _________________
                    //            |                 |_
                    //         _ _|                   |
                    //        |                       |
                    //        |                    _ _|
                    //        |                   |   
                    //        |___________________| 
                    // The missing corners of the shape are filled with the radial gradients drawn above

                    // Define shape counter clockwise
                    PathFigure figure = new PathFigure();

                    if (cornerRadius.TopLeft > ShadowDepth)
                    {
                        figure.StartPoint = new Point(guidelineSetX[1], guidelineSetY[0]);
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[1], guidelineSetY[1]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[0], guidelineSetY[1]), true));
                    }
                    else
                    {
                        figure.StartPoint = new Point(guidelineSetX[0], guidelineSetY[0]);
                    }

                    if (cornerRadius.BottomLeft > ShadowDepth)
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[0], guidelineSetY[3]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[3], guidelineSetY[3]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[3], guidelineSetY[5]), true));
                    }
                    else
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[0], guidelineSetY[5]), true));
                    }

                    if (cornerRadius.BottomRight > ShadowDepth)
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[4], guidelineSetY[5]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[4], guidelineSetY[4]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[5], guidelineSetY[4]), true));
                    }
                    else
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[5], guidelineSetY[5]), true));
                    }


                    if (cornerRadius.TopRight > ShadowDepth)
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[5], guidelineSetY[2]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[2], guidelineSetY[2]), true));
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[2], guidelineSetY[0]), true));
                    }
                    else
                    {
                        figure.Segments.Add(new LineSegment(new Point(guidelineSetX[5], guidelineSetY[0]), true));
                    }
                    
                    figure.IsClosed = true;
                    figure.Freeze();

                    PathGeometry geometry = new PathGeometry();
                    geometry.Figures.Add(figure);
                    geometry.Freeze();

                    drawingContext.DrawGeometry(brushes[Center], null, geometry);
                }

                drawingContext.Pop();
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:SystemDropShadowChrome.cs

示例10: OnRender

        /// <summary>
        /// 描画処理のオーバーライド
        /// </summary>
        /// <param name="drawingContext">描画先のコンテキスト</param>
        protected override void OnRender(DrawingContext drawingContext)
        {
#if DEBUG
            Debug.WriteLine("[{0}] OnRender[{1}]", this._measureCounter, this.RenderSize);
#endif

            if (this.IsDesignMode)
            {
                // 背景色
                drawingContext.DrawRectangle(new SolidColorBrush(Colors.AntiqueWhite), null, new Rect(this.RenderSize));
            }

            var borderBrush = this.BorderBrush ?? new SolidColorBrush(this.IsDesignMode ? Colors.Black : (Color)this.FindResource("GraphBorderColor"));
            var tickBorderBrush = this.TickBorderBrush ?? borderBrush;
            var stroke = this.Stroke ?? borderBrush;

            // グラフ外枠円
            var radius = this._mainboardSize.Width / 2.0 - this.GraphMargin;
            drawingContext.DrawEllipse(this.Background, new Pen(borderBrush, this.BorderThickness), this._mainboardCenter, radius, radius);

            // 角度
            var angle = 360.0 / this.InternalChildren.Count;

            #region 基準軸の描画
            for (var i = 0; i < this.InternalChildren.Count; i++)
            {
                var pt = this._mainboardCenter;
                pt.Offset(0.0, -radius);
                drawingContext.DrawLine(new Pen(tickBorderBrush, this.TickBorderThickness), this._mainboardCenter, pt.Rotate(i * angle, this._mainboardCenter));

                // 目盛
                if (this.Ticks > 0)
                {
                    var div = radius / this.Ticks;
                    for (var j = 1; j < this.Ticks; j++)
                    {
                        var pt1 = this._mainboardCenter;
                        pt1.Offset(0.0, -j * div);
                        var pt2 = pt1;
                        pt1.Offset(-this.TickWidth / 2.0, 0.0);
                        pt2.Offset(this.TickWidth / 2.0, 0.0);
                        drawingContext.DrawLine(new Pen(tickBorderBrush, this.TickBorderThickness), pt1.Rotate(i * angle, this._mainboardCenter), pt2.Rotate(i * angle, this._mainboardCenter));
                    }
                }
            }
            #endregion 基準軸の描画

            #region データ領域の描画
            if (this.Values != null)
            {
                var values = this.InternalChildren.Count - this.Values.Count() >= 0 ? this.Values.Concat(Enumerable.Range(0, this.InternalChildren.Count - this.Values.Count()).Select(x => 0.0)) : this.Values.Take(this.InternalChildren.Count);
                var points = values.Select((x, i) =>
                {
                    var pt = this._mainboardCenter;
                    pt.Offset(0.0, -radius * x / this.Maximum);
                    return pt.Rotate(i * angle, this._mainboardCenter);
                });

                var figure = new PathFigure() { IsClosed = true };
                foreach (var item in points.Select((x, i) => new { Point = x, IsFirst = i == 0 }))
                {
                    // 線の描画の準備
                    if (item.IsFirst)
                    {
                        figure.StartPoint = item.Point;
                    }
                    else
                    {
                        figure.Segments.Add(new LineSegment(item.Point, true));
                    }
                }

                if (figure.IsFrozen)
                {
                    figure.Freeze();
                }
                var geometry = new PathGeometry();
                geometry.Figures.Add(figure);
                drawingContext.DrawGeometry(this.Fill, new Pen(stroke, this.StrokeThickness), geometry);

                if (this.PointElement != null)
                {
                    this.PointElement.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                    var visualBrush = new VisualBrush(this.PointElement);
                    foreach (var pt in points)
                    {
                        var point = pt;
                        point.Offset(-this.PointElement.DesiredSize.Width / 2.0, -this.PointElement.DesiredSize.Height / 2.0);
                        // 点の描画
                        drawingContext.DrawRectangle(visualBrush, null, new Rect(point, this.PointElement.DesiredSize));
                    }
                }
            }
            #endregion データ領域の描画
        }
开发者ID:YKSoftware,项目名称:YKToolkit.Controls,代码行数:99,代码来源:Generic.RadarChart.xaml.cs

示例11: OnRender

        /// <summary>
        /// 描画処理をおこないます。
        /// </summary>
        /// <param name="dc">描画するコンテキスト</param>
        protected override void OnRender(DrawingContext dc)
        {
            //base.OnRender(dc);

            if (XAxisData == null)
            {
                IsDataEnabled = false;
                return;
            }
            if (YAxisData == null)
            {
                IsDataEnabled = false;
                return;
            }

            var xArray = XAxisData.OfType<double>().ToArray();
            var yArray = YAxisData.OfType<double>().ToArray();
            var length = xArray.Length < yArray.Length ? xArray.Length : yArray.Length;
            Point? pt0 = null;
            var isLineFirst = true;
            var pathfigure = new PathFigure();
            var pen = new Pen(this.Color != null ? new SolidColorBrush(this.Color.Value) : this.Stroke, this.Thickness);
            pen.Freeze();
            Pen markerPen = null;
            if (this.MarkerPen != null)
            {
                markerPen = this.Color != null ? new Pen(new SolidColorBrush(this.Color.Value), this.MarkerPen.Thickness) : this.MarkerPen;
                markerPen.Freeze();
            }
            var markerFill = this.Color != null ? new SolidColorBrush(this.Color.Value) : this.Fill;
            if (markerFill != null)
                markerFill.Freeze();
            for (var i = 0; i < length; i++)
            {
                if (IsStrokeEnabled)
                {
                    #region 線の描画
                    if (pt0 != null)
                    {

                        if ((pt0.Value.Y >= this.YMax) && (yArray[i] >= this.YMax))
                        {
                            // 絶対に線の描画があり得ないパターン
                        }
                        else if ((pt0.Value.Y <= this.YMin) && (yArray[i] <= this.YMin))
                        {
                            // 絶対に線の描画があり得ないパターン
                        }
                        else
                        {
                            Point? ptLine0 = null;
                            Point? ptLine1 = null;

                            // 以前の点が右端より左側にあって
                            // 今回の点が左端より右側にある場合のみ
                            // 線を描画する可能性がある
                            if ((pt0.Value.X < this.XMax) && (xArray[i] > this.XMin))
                            {
                                // 以前の点が範囲内ならこれを左端の点とする
                                if ((this.XMin <= pt0.Value.X) && (pt0.Value.X <= this.XMax) && (this.YMin <= pt0.Value.Y) && (pt0.Value.Y <= this.YMax))
                                {
                                    ptLine0 = GetControlPointFromGraphPoint(pt0.Value);
                                }
                                // 今回の点が範囲内ならこれを右端の点とする
                                if ((this.XMin <= xArray[i]) && (xArray[i] <= this.XMax) && (this.YMin <= yArray[i]) && (yArray[i] <= this.YMax))
                                {
                                    ptLine1 = GetControlPointFromGraphPoint(xArray[i], yArray[i]);
                                }

                                // 左端または右端の点が確定していない場合はグラフ表示範囲の境界線との交点を調べる
                                if ((ptLine0 == null) || (ptLine1 == null))
                                {
                                    // y = ax + b
                                    // 傾き
                                    double? a = xArray[i] != pt0.Value.X ? (yArray[i] - pt0.Value.Y) / (xArray[i] - pt0.Value.X) : (double?)null;
                                    if (a != null)
                                    {
                                        // 切片
                                        double b = pt0.Value.Y - a.Value * pt0.Value.X;

                                        // 左端縦軸との交点
                                        var yLeft = a.Value * this.XMin + b;
                                        // 右端縦軸との交点
                                        var yRight = a.Value * this.XMax + b;
                                        // 上端横軸との交点
                                        var xTop = (this.YMax - b) / a.Value;
                                        // 下端横軸との交点
                                        var xBottom = (this.YMin - b) / a.Value;

                                        #region 左端の点を確定する
                                        if (ptLine0 == null)
                                        {
                                            // 左端縦軸交点の確認
                                            if ((this.YMin <= yLeft) && (yLeft <= this.YMax))
                                            {
                                                ptLine0 = GetControlPointFromGraphPoint(this.XMin, yLeft);
//.........这里部分代码省略.........
开发者ID:YKSoftware,项目名称:YKToolkit.Controls,代码行数:101,代码来源:LineGraphItem.cs

示例12: RenderTheme

        private void RenderTheme(DrawingContext dc)
        {
            Size size = RenderSize;
            bool isClickable = IsClickable && IsEnabled;
            bool isPressed = isClickable && IsPressed;
            ListSortDirection? sortDirection = SortDirection;
            bool isSorted = sortDirection != null;
            bool horizontal = Orientation == Orientation.Horizontal;
            Brush background = EnsureControlBrush();
            Brush light = SystemColors.ControlLightBrush;
            Brush dark = SystemColors.ControlDarkBrush;
            bool shouldDrawRight = true;
            bool shouldDrawBottom = true;
            bool usingSeparatorBrush = false;

            Brush darkDarkRight = null;
            if (!horizontal)
            {
                if (SeparatorVisibility == Visibility.Visible && SeparatorBrush != null)
                {
                    darkDarkRight = SeparatorBrush;
                    usingSeparatorBrush = true;
                }
                else
                {
                    shouldDrawRight = false;
                }
            }
            else
            {
                darkDarkRight = SystemColors.ControlDarkDarkBrush;
            }

            Brush darkDarkBottom = null;
            if (horizontal)
            {
                if (SeparatorVisibility == Visibility.Visible && SeparatorBrush != null)
                {
                    darkDarkBottom = SeparatorBrush;
                    usingSeparatorBrush = true;
                }
                else
                {
                    shouldDrawBottom = false;
                }
            }
            else
            {
                darkDarkBottom = SystemColors.ControlDarkDarkBrush;
            }

            EnsureCache((int)ClassicFreezables.NumFreezables);

            // Draw the background
            dc.DrawRectangle(background, null, new Rect(0.0, 0.0, size.Width, size.Height));

            if ((size.Width > 3.0) && (size.Height > 3.0))
            {
                // Draw the border
                if (isPressed)
                {
                    dc.DrawRectangle(dark, null, new Rect(0.0, 0.0, size.Width, 1.0));
                    dc.DrawRectangle(dark, null, new Rect(0.0, 0.0, 1.0, size.Height));
                    dc.DrawRectangle(dark, null, new Rect(0.0, Max0(size.Height - 1.0), size.Width, 1.0));
                    dc.DrawRectangle(dark, null, new Rect(Max0(size.Width - 1.0), 0.0, 1.0, size.Height));
                }
                else
                {
                    dc.DrawRectangle(light, null, new Rect(0.0, 0.0, 1.0, Max0(size.Height - 1.0)));
                    dc.DrawRectangle(light, null, new Rect(0.0, 0.0, Max0(size.Width - 1.0), 1.0));

                    if (shouldDrawRight)
                    {
                        if (!usingSeparatorBrush)
                        {
                            dc.DrawRectangle(dark, null, new Rect(Max0(size.Width - 2.0), 1.0, 1.0, Max0(size.Height - 2.0)));
                        }

                        dc.DrawRectangle(darkDarkRight, null, new Rect(Max0(size.Width - 1.0), 0.0, 1.0, size.Height));
                    }

                    if (shouldDrawBottom)
                    {
                        if (!usingSeparatorBrush)
                        {
                            dc.DrawRectangle(dark, null, new Rect(1.0, Max0(size.Height - 2.0), Max0(size.Width - 2.0), 1.0));
                        }

                        dc.DrawRectangle(darkDarkBottom, null, new Rect(0.0, Max0(size.Height - 1.0), size.Width, 1.0));
                    }
                }
            }

            if (isSorted && (size.Width > 14.0) && (size.Height > 10.0))
            {
                // If sorted, draw an arrow on the right
                TranslateTransform positionTransform = new TranslateTransform(size.Width - 15.0, (size.Height - 5.0) * 0.5);
                positionTransform.Freeze();
                dc.PushTransform(positionTransform);

//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:DataGridHeaderBorder.cs

示例13: GenerateRectFigure

        // Creates a rectangle figure
        private static PathFigure GenerateRectFigure(Rect rect)
        {
            PathFigure figure = new PathFigure();
            figure.StartPoint = rect.TopLeft;
            figure.Segments.Add(new LineSegment(rect.TopRight, true));
            figure.Segments.Add(new LineSegment(rect.BottomRight, true));
            figure.Segments.Add(new LineSegment(rect.BottomLeft, true));
            figure.IsClosed = true;
            figure.Freeze();

            return figure;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:13,代码来源:ClassicBorderDecorator.cs

示例14: GenerateTabTopShadowGeometry

        // The shadow geometry is the right borders with top rounded corner 
        private Geometry GenerateTabTopShadowGeometry(Rect bounds, bool outerBorder)
        {
            double outerRadius = outerBorder ? 3.0 : 2.0;
            double innerRadius = outerRadius - 1.0;
            Size outerCorner = new Size(outerRadius, outerRadius), innerCorner = new Size(innerRadius, innerRadius);

            double right = bounds.Right, top = bounds.Top, bottom = bounds.Bottom - 1.0; 

            PathFigure figure = new PathFigure();
            //Start at bottom left, tracing the outside clockwise
            figure.StartPoint = new Point(right - 1.0, bottom);
            figure.Segments.Add(new LineSegment(new Point(right - 1.0, top + outerRadius), true));  //left side
            figure.Segments.Add(new ArcSegment(new Point(right - 1.0 - innerRadius * 0.293, top + 1.0 + innerRadius * 0.293), innerCorner, 0.0, false, SweepDirection.Counterclockwise, true)); //inner left rounded corner
            figure.Segments.Add(new LineSegment(new Point(right - outerRadius * 0.293, top + outerRadius * 0.293), true)); //top right corner  
            figure.Segments.Add(new ArcSegment(new Point(right, top + outerRadius), outerCorner, 0.0, false, SweepDirection.Clockwise, true)); //top right corner  
            figure.Segments.Add(new LineSegment(new Point(right, bottom), true)); //right side
            figure.IsClosed = true; //bottom side
            figure.Freeze();

            PathGeometry geometry = new PathGeometry();
            geometry.Figures.Add(figure);
            geometry.Freeze();

            return geometry;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:26,代码来源:ClassicBorderDecorator.cs

示例15: _renderShadow

      /// <summary/>
      private void _renderShadow(DrawingContext dc, Size bounds) {
         var D = 7.5 - Softness*5.0;
         var W = bounds.Width;
         var H = bounds.Height;
         if (W <= 0.0 || H <= 0.0) return;

         var X0 = Depth/2;
         var Y0 = Depth/2;
         var X1 = W + Depth;
         var Y1 = H + Depth;

         double R0 = Math.Min(W / 2.0, H / 2.0);
         var TL = Math.Min(CornerRadius.TopLeft, R0) + D;
         var TR = Math.Min(CornerRadius.TopRight, R0) + D;
         var BL = Math.Min(CornerRadius.BottomLeft, R0) + D;
         var BR = Math.Min(CornerRadius.BottomRight, R0) + D;

         double[] GX = new double[] { X0 + D, X0 + TL, X1 - TR, X0 + BL, X1 - BR, X1 - D };
         double[] GY = new double[] { Y0 + D, Y0 + TL, Y0 + TR, Y1 - BL, Y1 - BR, Y1 - D };
         dc.PushGuidelineSet(new GuidelineSet(GX, GY));

         // draw corners and edge
         var brushes = _getBrushes(Color, CornerRadius);
         dc.DrawRectangle(brushes[0], null, new Rect(X0, Y0, TL, TL));                    // top-left corner
         dc.DrawRectangle(brushes[2], null, new Rect(GX[2], Y0, TR, TR));                 // top-right corner
         dc.DrawRectangle(brushes[6], null, new Rect(X0, GY[3], BL, BL));                 // bottom-left corner 
         dc.DrawRectangle(brushes[8], null, new Rect(GX[4], GY[4], BR, BR));              // bottom-right corner 
         if (GX[2] > GX[1]) {
            dc.DrawRectangle(brushes[1], null, new Rect(GX[1], Y0, GX[2] - GX[1], D));    // top edge
         }
         if (GY[3] > GY[1]) {
            dc.DrawRectangle(brushes[3], null, new Rect(X0, GY[1], D, GY[3] - GY[1]));    // left edge
         }
         if (GY[4] > GY[2]) {
            dc.DrawRectangle(brushes[5], null, new Rect(GX[5], GY[2], D, GY[4] - GY[2])); // right edge
         }
         if (GX[4] > GX[3]) {
            dc.DrawRectangle(brushes[7], null, new Rect(GX[3], GY[5], GX[4] - GX[3], D)); // bottom edge
         }

         // draw center box
         if (TL == D && TR == D && BL == D && BR == D) {
            if (W > 2*D && H > 2*D) {
               var box = new Rect(GX[0], GY[0], W-2*D, H-2*D);
               dc.DrawRectangle(brushes[4], null, box);
            }
         } else {
            var fig = new PathFigure();
            if (TL > D) {
               fig.StartPoint = new Point(GX[1], GY[0]);
               fig.Segments.Add(new LineSegment(new Point(GX[1], GY[1]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[0], GY[1]), true));
            } else {
               fig.StartPoint = new Point(GX[0], GY[0]);
            }
            if (BL > D) {
               fig.Segments.Add(new LineSegment(new Point(GX[0], GY[3]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[3], GY[3]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[3], GY[5]), true));
            } else {
               fig.Segments.Add(new LineSegment(new Point(GX[0], GY[5]), true));
            }
            if (BR > D) {
               fig.Segments.Add(new LineSegment(new Point(GX[4], GY[5]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[4], GY[4]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[5], GY[4]), true));
            } else {
               fig.Segments.Add(new LineSegment(new Point(GX[5], GY[5]), true));
            }
            if (TR > D) {
               fig.Segments.Add(new LineSegment(new Point(GX[5], GY[2]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[2], GY[2]), true));
               fig.Segments.Add(new LineSegment(new Point(GX[2], GY[0]), true));
            } else {
               fig.Segments.Add(new LineSegment(new Point(GX[5], GY[0]), true));
            }
            fig.IsClosed = true;
            fig.Freeze();
            PathGeometry geometry = new PathGeometry{
               Figures = { fig }
            };
            geometry.Freeze();
            dc.DrawGeometry(brushes[4], null, geometry);
         }

         dc.Pop();
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:88,代码来源:DropShadow.cs


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