zoukankan      html  css  js  c++  java
  • DotNetMagic的一个Bug

        一个文字颠倒的Bug(对中文而言),在最新的3.0.1中依然存在,看图:

        理想的情况当然是这样:

        花了些时间看了看,发现是在DrawReverseString函数中出的问题,修改如下:

            public static void DrawReverseString(Graphics g,
                                                 String drawText,
                                                 Font drawFont,
                                                 Rectangle drawRect,
                                                 Brush drawBrush,
                                                 StringFormat drawFormat)
            {
                GraphicsContainer container = g.BeginContainer();

                // The text will be rotated around the origin (0,0) and so needs moving
                // back into position by using a transform
                g.TranslateTransform(drawRect.Top, drawRect.Left + drawRect.Height);

                // Rotate the text by 180 degress to reverse the direction
                g.RotateTransform(-90);

       int tmp = drawRect.Width;
       drawRect.Width = drawRect.Height;
       drawRect.Height = tmp;
                // Draw the string as normal and let then transforms do the work
                g.DrawString(drawText, drawFont, drawBrush, drawRect, drawFormat);

                g.EndContainer(container);
            }

        另外,需要去掉DrawColumn函数中的设置的一个StringFormatFlags:

                format.FormatFlags = //StringFormatFlags.DirectionVertical |
                                     StringFormatFlags.NoClip |
                                     StringFormatFlags.NoWrap;
        
        不过修改之后没有详细测试,不知道在其它地方是否会出问题。
        感谢木头指出这个Bug。

  • 相关阅读:
    分布式集群系统下的高可用session解决方案
    Google大数据三篇著名论文中文版
    12款免费与开源的NoSQL数据库介绍
    揭密Node.js 盛行的因由(转载)
    lion.ec开源框架简介(原创)
    2.2 Hadoop Studio 使用 [Hadoop学习笔记]
    spring3.2+ehcache 注解使用
    Venus 是一个简单的、高性能、高并发能力的java 开源Remoting框架
    ZooKeeper原理分析
    Netty系列之Netty高性能之道(转载InfoQ)
  • 原文地址:https://www.cnblogs.com/s5689412/p/194453.html
Copyright © 2011-2022 走看看