zoukankan      html  css  js  c++  java
  • 【WPF】创建文本字符串的路径PathGeometry

            /// <summary>
            /// 创建文本路径
            /// </summary>
            /// <param name="word">文本字符串</param>
            /// <param name="point">显示位置</param>
            /// <param name="typeface">字体信息</param>
            /// <param name="fontSize">字体大小</param>
            /// <returns></returns>
            public static Geometry CreateTextPath(string word, Point point, Typeface typeface, int fontSize)
            {
                FormattedText text = new FormattedText(word,
                new System.Globalization.CultureInfo("zh-cn"),
                FlowDirection.LeftToRight, typeface, fontSize,
                Brushes.Black);
                Geometry geo = text.BuildGeometry(point);
                PathGeometry path = geo.GetFlattenedPathGeometry();
                return path;
            }

    使用:

     var pathgeometry = CreateTextPath("梦琪D路飞", new Point(0, 0), new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal), (int)fontsize);
  • 相关阅读:
    Mysql任务调度
    使用 IntraWeb (18)
    使用 IntraWeb (17)
    替盛大代发的招聘启示
    使用 IntraWeb (16)
    使用 IntraWeb (15)
    使用 IntraWeb (14)
    使用 IntraWeb (13)
    使用 IntraWeb (12)
    使用 IntraWeb (11)
  • 原文地址:https://www.cnblogs.com/mqxs/p/9934276.html
Copyright © 2011-2022 走看看