private void DrawLineCore(Point from, Point to, float width, Color color, LineStyle lineStyle, Action <Pen> initializePen)
        {
            using (var brush = new SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)))
                using (var pen = new Pen(brush, width))
                {
                    initializePen(pen);

                    switch (lineStyle)
                    {
                    case LineStyle.Clean:
                        m_Graphics.DrawLine(pen, from.ToPointF(), to.ToPointF());
                        break;

                    case LineStyle.Sketchy:
                        using (AntiAliasedGraphics())
                        {
                            var bezierCurve = new BezierCurve(from, to);
                            m_Graphics.DrawBezier(pen, from.ToPointF(), bezierCurve.FirstControlPoint.ToPointF(), bezierCurve.SecondControlPoint.ToPointF(), to.ToPointF());
                        }
                        break;

                    default:
                        break;
                    }
                }
        }
        public void FillRectangle(Point location, Size size, Color color)
        {
            var rectangle = new RectangleF(location.ToPointF(), size.ToSizeF());

            using (var brush = new SolidBrush(color.ToColor()))
            {
                m_Graphics.FillRectangle(brush, rectangle);
            }
        }
        public void DrawRectangle(Point location, Size size, Color color, LineStyle lineStyle)
        {
            var rectangle = new RectangleF(location.ToPointF(), size.ToSizeF());

            using (var pen = new Pen(color.ToColor()))
            {
                Point topLeft     = location;
                Point topRight    = location.Offset(size.Width, 0);
                Point bottomLeft  = location.Offset(0, size.Height);
                Point bottomRight = location.Offset(size.Width, size.Height);

                DrawLineCore(topLeft, topRight, pen.Width, color, lineStyle);
                DrawLineCore(topRight, bottomRight, pen.Width, color, lineStyle);
                DrawLineCore(bottomRight, bottomLeft, pen.Width, color, lineStyle);
                DrawLineCore(bottomLeft, topLeft, pen.Width, color, lineStyle);
            }
        }
        public void DrawText(Point location, Size size, string text, Font font, float fontSize, Color color, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            using (var drawFont = CreateFont(font, fontSize))
            {
                var rectangle = new RectangleF(location.ToPointF(), size.ToSizeF());

                using (var stringFormat = new StringFormat())
                {
                    stringFormat.Alignment     = horizontalAlignment.ToStringAlignment();
                    stringFormat.LineAlignment = verticalAlignment.ToStringAlignment();

                    using (var brush = new SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)))
                    {
                        string stringToDraw = ReplaceLineBreaks(text);
                        m_Graphics.DrawString(stringToDraw, drawFont, brush, rectangle, stringFormat);
                    }
                }
            }
        }