예제 #1
0
        void PaintRound(DrawingContext dc)
        {
            if (Height < BracketBreakLimit)
            {
                if (SignType == BracketSignType.LeftRound)
                {
                    signText.DrawTextTopLeftAligned(dc, new Point(SignLeft, Top));
                }
                else
                {
                    signText.DrawTextTopRightAligned(dc, new Point(SignRight, Top));
                }
            }
            else
            {
                if (SignType == BracketSignType.LeftRound)
                {
                    double left = Math.Floor(SignLeft);
                    signText.DrawTextTopLeftAligned(dc, new Point(left, Top));
                    signText2.DrawTextBottomLeftAligned(dc, new Point(left, Bottom));
                    double top    = Top + signText.Extent * .9;
                    double bottom = Bottom - signText2.Extent * .9;
                    //double topExtra = extension.Height + extension.OverhangAfter - extension.Extent;
                    double padding  = extension.OverhangLeading;
                    var    geometry = extension.BuildGeometry(new Point(left - padding, 0));

                    PointCollection points = new PointCollection {
                        new Point(geometry.Bounds.Right, top),
                        new Point(geometry.Bounds.Right, bottom),
                        new Point(geometry.Bounds.Left, bottom),
                    };
                    dc.FillPolylineGeometry(new Point(geometry.Bounds.Left, top), points);

                    //Pen pen = PenManager.GetPen(extension.GetFullWidth() * .68);
                    //dc.DrawLine(pen, new Point(SignLeft + pen.Thickness * .68, top),
                    //                 new Point(SignLeft + pen.Thickness * .68, bottom));

                    ////double topExtra = extension.Height + extension.OverhangAfter - extension.Extent;
                    ////double padding = extension.OverhangLeading;
                    ////var geometry = extension.BuildGeometry(new Point(SignLeft - padding, top - topExtra));
                    ////Pen pen = new Pen(Brushes.Black, geometry.Bounds.Width);
                    ////dc.DrawLine(pen, new Point(SignLeft + pen.Thickness - padding * 1.2, top),
                    ////                 new Point(SignLeft + LineThickness - padding * 1.2, bottom));
                    //var geometry2 = extension.BuildGeometry(new Point(SignLeft - 10, (top - topExtra)/2));
                    //var geometry3 = extension.BuildGeometry(new Point(SignLeft - 20, 10));
                    //double factor = (bottom - top) / (extension.Extent);
                    //ScaleTransform scale = new ScaleTransform(1.0, factor);
                    //scale.CenterY = extension.Extent / 2;
                    //scale.CenterY = geometry2.Bounds.Height;
                    //geometry2.Transform = scale;
                    //ScaleTransform scale2 = new ScaleTransform(1.0, 3);
                    //geometry3.Transform = scale2;
                    //dc.DrawGeometry(Brushes.Red, null, geometry);
                    //dc.DrawGeometry(Brushes.Blue, null, geometry2);
                    //dc.DrawGeometry(Brushes.Green, null, geometry3);
                    //var geo = Geometry.Combine(geometry, geometry, GeometryCombineMode.Intersect, scale);
                    //dc.DrawGeometry(Brushes.HotPink, null, geo);
                    //dc.PushTransform(scale);
                    //double topExtra = extension.Height + extension.OverhangAfter - extension.Extent;
                    //double padding = extension.OverhangLeading;
                    //dc.DrawText(extension, new Point(SignLeft - padding, top - (topExtra/factor)));
                    //dc.Pop();

                    //while (top < bottom)
                    //{
                    //    extension.DrawTextTopLeftAligned(dc, new Point(SignLeft, top));
                    //    top += extension.Extent *.85;
                    //    double shoot = (top + extension.Extent) - bottom;
                    //    if (shoot > 0)
                    //    {
                    //        top -= shoot;
                    //        extension.DrawTextTopLeftAligned(dc, new Point(SignLeft, top));
                    //        break;
                    //    }
                    //}
                }
                else
                {
                    signText.DrawTextTopRightAligned(dc, new Point(SignRight, Top));
                    signText2.DrawTextBottomRightAligned(dc, new Point(SignRight, Bottom));
                    double top      = Top + signText.Extent * .9;
                    double bottom   = Bottom - signText2.Extent * .9;
                    var    geometry = extension.BuildGeometry(new Point(SignRight - extension.GetFullWidth() - extension.OverhangLeading, 0));

                    PointCollection points = new PointCollection {
                        new Point(geometry.Bounds.Right, top),
                        new Point(geometry.Bounds.Right, bottom),
                        new Point(geometry.Bounds.Left, bottom),
                    };
                    dc.FillPolylineGeometry(new Point(geometry.Bounds.Left, top), points);
                    //double topExtra = extension.Height + extension.OverhangAfter - extension.Extent;
                    ////double padding = extension.OverhangLeading;
                    ////var geometry = extension.BuildGeometry(new Point(SignLeft, top));
                    ////Pen pen = new Pen(Brushes.Black, geometry.Bounds.Width);
                    ////dc.DrawLine(pen, new Point(SignRight - pen.Thickness * .65, top),
                    ////                 new Point(SignRight - pen.Thickness * .65, bottom));
                    //dc.DrawLine(new Pen(Brushes.Red, 1), new Point(SignLeft, Top), new Point(SignLeft, Bottom));
                    //Pen pen = PenManager.GetPen(extension.GetFullWidth() * .68);
                    //dc.DrawLine(pen, new Point(SignRight - pen.Thickness * .68, top),
                    //                 new Point(SignRight - pen.Thickness * .68, bottom));
                    //while (top < bottom)
                    //{
                    //    extension.DrawTextTopRightAligned(dc, new Point(left + signText.GetFullWidth(), top));
                    //    top += extension.Extent * .85;
                    //    double shoot = (top + extension.Extent) - bottom;
                    //    if (shoot > 0)
                    //    {
                    //        top -= shoot;
                    //        extension.DrawTextTopRightAligned(dc, new Point(left + signText.GetFullWidth(), top));
                    //        break;
                    //    }
                    //}
                }
            }
        }