Esempio n. 1
0
        public override void DrawRoundedRect <TRectangle, TPen, TThickness>(TRectangle rect,
                                                                            TPen pen,
                                                                            TThickness cornerRadii)
        {
            if (cornerRadii.IsEmpty)
            {
                DrawRect(rect, pen);
                return;
            }

            var useRect = _boxModel.GetAbsoluteRect(rect, ZoomLevel);
            var usePen  = GdiTypeConverter.GetPen(pen);

            using (var path = new GdiGraphicsPath())
            {
                path.SetRoundedRectangle(useRect, cornerRadii);
                Graphics.DrawPath(usePen, path.Path);
            }
        }
Esempio n. 2
0
        public override void FillRoundedRectangle <TRectangle, TBrush, TThickness>(TRectangle rect,
                                                                                   TBrush brush,
                                                                                   TThickness cornerRadii)
        {
            if (cornerRadii.IsEmpty)
            {
                FillRectangle(rect, brush);
                return;
            }

            var useRect = _boxModel.GetAbsoluteRect(rect, ZoomLevel);

            var useBrush = GdiTypeConverter.GetBrush(brush);

            using (var path = new GdiGraphicsPath())
            {
                path.SetRoundedRectangle(useRect, cornerRadii);
                Graphics.FillPath(useBrush, path.Path);
            }
        }