コード例 #1
0
        public bool DrawString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci)
        {
            Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci);

            for (int i = 1; i <= m_nThickness; ++i)
            {
                SolidColorBrush solidbrush = new SolidColorBrush(m_clrOutline);

                Pen pen = new Pen(solidbrush, i);
                pen.LineJoin = PenLineJoin.Round;
                if (m_bClrText)
                {
                    SolidColorBrush brush = new SolidColorBrush(m_clrText);
                    graphics.DrawGeometry(brush, pen, path);
                }
                else
                {
                    graphics.DrawGeometry(m_brushText, pen, path);
                }
            }

            return(true);
        }
コード例 #2
0
        public bool DrawString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci)
        {
            Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci);

            if (m_bClrText)
            {
                SolidColorBrush brush = new SolidColorBrush(m_clrText);
                Pen             pen   = new Pen(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), 1.0);
                graphics.DrawGeometry(brush, pen, path);
            }
            else
            {
                Pen pen = new Pen(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), 1.0);
                graphics.DrawGeometry(m_brushText, pen, path);
            }
            return(true);
        }
コード例 #3
0
        public bool DrawString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci)
        {
            int nOffset = Math.Abs(m_nOffsetX);

            if (Math.Abs(m_nOffsetX) == Math.Abs(m_nOffsetY))
            {
                nOffset = Math.Abs(m_nOffsetX);
            }
            else if (Math.Abs(m_nOffsetX) > Math.Abs(m_nOffsetY))
            {
                nOffset = Math.Abs(m_nOffsetY);
            }
            else if (Math.Abs(m_nOffsetX) < Math.Abs(m_nOffsetY))
            {
                nOffset = Math.Abs(m_nOffsetX);
            }

            for (int i = 0; i < nOffset; ++i)
            {
                Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize,
                                                           new Point(ptDraw.X + ((i * (-m_nOffsetX)) / nOffset), ptDraw.Y + ((i * (-m_nOffsetY)) / nOffset)), ci);

                SolidColorBrush solidbrush = new SolidColorBrush(m_clrOutline);

                Pen pen = new Pen(solidbrush, m_nThickness);
                pen.LineJoin = PenLineJoin.Round;

                if (m_bClrText)
                {
                    SolidColorBrush brush = new SolidColorBrush(m_clrText);
                    graphics.DrawGeometry(brush, pen, path);
                }
                else
                {
                    graphics.DrawGeometry(m_brushText, pen, path);
                }
            }

            return(true);
        }
コード例 #4
0
        public Rect MeasureString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci,
            ref double fStartX,
            ref double fStartY,
            ref double fDestWidth,
            ref double fDestHeight)
        {
            Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci);

            Pen pen = new Pen(new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)), m_nThickness1 + m_nThickness2);

            return(path.GetRenderBounds(pen));
        }
コード例 #5
0
        public bool DrawString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci)
        {
            Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci);

            SolidColorBrush solidbrush = new SolidColorBrush(m_clrOutline);
            Pen             pen        = new Pen(solidbrush, m_nThickness);

            pen.LineJoin = PenLineJoin.Round;
            SolidColorBrush transbrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

            graphics.DrawGeometry(transbrush, pen, path);

            return(true);
        }
コード例 #6
0
        public bool DrawString(
            System.Windows.Media.DrawingContext graphics,
            System.Windows.Media.FontFamily fontFamily,
            System.Windows.FontStyle fontStyle,
            System.Windows.FontWeight fontWeight,
            double fontSize,
            string strText,
            System.Windows.Point ptDraw,
            System.Globalization.CultureInfo ci)
        {
            Geometry path = GDIPath.CreateTextGeometry(strText, fontFamily, fontStyle, fontWeight, fontSize, ptDraw, ci);

            List <Color> list = new List <Color>();

            CalculateGradient(
                m_clrOutline1,
                m_clrOutline2,
                m_nThickness,
                list);

            for (int i = m_nThickness; i >= 1; --i)
            {
                SolidColorBrush solidbrush = new SolidColorBrush(list[i - 1]);

                Pen pen1 = new Pen(solidbrush, i);
                pen1.LineJoin = PenLineJoin.Round;
                if (m_bClrText)
                {
                    SolidColorBrush brush = new SolidColorBrush(m_clrText);
                    graphics.DrawGeometry(brush, pen1, path);
                }
                else
                {
                    graphics.DrawGeometry(m_brushText, pen1, path);
                }
            }

            return(true);
        }