zoukankan      html  css  js  c++  java
  • 单行文字压缩处理(要指定字体)

    代码
            /// <summary>
            
    /// 单行文字压缩处理
             
    /// </summary>
            
    /// <param name="txt">单行文字</param>
            
    /// <param name="dL">需要压到的长度</param>
            public static void RarDBText(Database db, DBText txt, double dL)
            {
                
    if (txt.TextString.Equals("")) return;
                txt.TextStyle 
    = db.Textstyle; //因为不同的字体它的范围不同,如果没有此句,将默认为gbig字体,将出现偏差
                double ange = txt.Rotation;
                TextHorizontalMode horM 
    = txt.HorizontalMode;

                txt.Rotation 
    = 0;
                txt.HorizontalMode 
    = TextHorizontalMode.TextLeft;

                
    double xL = txt.GeometricExtents.MaxPoint.X - txt.Position.X;

                
    if (xL > dL)
                {
                    txt.WidthFactor 
    = txt.WidthFactor * (dL / xL);
                }

                
    //还原
                txt.Rotation = ange;
                txt.HorizontalMode 
    = horM;
            }
  • 相关阅读:
    ruby中的特殊字符
    android and webview
    ActiveRecord::Base.establish_connection
    Ruby 创建目录
    不能手动输入或粘贴
    eclipse找不到 help>software update>find and install
    PL/SQL 创建、查看、操作用户
    XML文件
    javascript 获取页面高度(多种浏览器)(转)
    Eclipse to android
  • 原文地址:https://www.cnblogs.com/houlinbo/p/1711255.html
Copyright © 2011-2022 走看看