zoukankan      html  css  js  c++  java
  • C# print Vertical text

    http://stackoverflow.com/questions/7655001/how-do-i-print-vertical-text-in-c-sharp-that-prints-up-stringformat-directionv
    http://stackoverflow.com/questions/955362/rotate-text-for-printing
    http://stackoverflow.com/questions/4460258/c-rotated-text-align
    http://msdn.microsoft.com/en-us/library/aa287525(v=vs.71).aspx
    http://msdn.microsoft.com/en-us/library/aa287530(v=vs.71).aspx
    http://www.c-sharpcorner.com/blogs/580/how-to-rotating-text-90-degrees-in-gdi.aspx

     1  int width = (int)(80 * 100 / 25.4 + 1);// (int)(190 * 100 / 25.4 + 1);  //216*97
     2             int height = (int)(226 * 100 / 25.4 + 1);
     3             // 橫向  false //縱向
     4             //this.printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Custum", 500, 300);
     5             PaperSize pkCustomSize = new PaperSize("Custum", 320, (int)(226 * 100 / 25.4 + 1)); //六福的工資單規格(int)(101 * 100 / 25.4 + 1) 400小了,401大了(int)(80 * 100 / 25.4 + 1)
     6             this.printDocument1.DefaultPageSettings.PaperSize = pkCustomSize;
     7             printDocument1.DefaultPageSettings.Landscape = false; //true縱向   //false橫向
     8 
     9             StringFormat format = new StringFormat();
    10             format.Alignment = StringAlignment.Center;
    11 
    12             SizeF txt = e.Graphics.MeasureString("中國工商銀行深圳市分行", this.Font);
    13             SizeF sz = new SizeF(width, height); //e.Graphics.VisibleClipBounds.Size;
    14 
    15             //90 degrees
    16             e.Graphics.TranslateTransform(sz.Width, 0);
    17             e.Graphics.RotateTransform(90.0F);
    18             e.Graphics.DrawString("中國建設銀行深圳市分行", this.Font, Brushes.Black, new RectangleF(30, 50, sz.Height, sz.Width), format);
    19             e.Graphics.ResetTransform();
    20 
    21             //180 degrees
    22             e.Graphics.TranslateTransform(sz.Width, sz.Height);
    23             e.Graphics.RotateTransform(180.0F);
    24             e.Graphics.DrawString("中國人民銀行深圳市分市", this.Font, Brushes.Black, new RectangleF(30, 50, sz.Width, sz.Height), format);
    25             e.Graphics.ResetTransform();
    26 
    27             //270 degrees
    28             e.Graphics.TranslateTransform(0, sz.Height);
    29             e.Graphics.RotateTransform(270.0F);
    30             e.Graphics.DrawString("中國工商銀行深圳市分行", this.Font, Brushes.Black, new RectangleF(30, 50, sz.Height, sz.Width), format);
    31             e.Graphics.ResetTransform();
    32 
    33             //0 = 360 degrees
    34             e.Graphics.TranslateTransform(0, 0);
    35             e.Graphics.RotateTransform(0.0F);
    36             e.Graphics.DrawString("深圳市農村商業銀行寶安支行", this.Font, Brushes.Black, new RectangleF(30, 50, sz.Width, sz.Height), format);
    37             e.Graphics.ResetTransform();
    38 
    39 
    40             //RectangleF tabbor = new RectangleF(0, 0, 44.35F, 150.0F);
    41             //StringFormat sf = new StringFormat();
    42             //sf.FormatFlags = StringFormatFlags.DirectionVertical;
    43             //String drawString = "First Line Second Line";
    44             //Font drawFont = new Font("Arial", 16);
    45             //SolidBrush drawBrush = new SolidBrush(Color.Black);
    46             //float x = 0F;
    47             //float y = 0F;
    48             //StringFormat drawFormat = new StringFormat();
    49             //drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
    50             ////Do 180 degree Rotatation Transformation
    51             //e.Graphics.RotateTransform(180, MatrixOrder.Append);
    52             //e.Graphics.TranslateTransform(50, 150, MatrixOrder.Append);
    53             //e.Graphics.DrawString(drawString, drawFont, Brushes.Black, tabbor, sf);
    54             //e.Graphics.DrawRectangle(Pens.Black, Rectangle.Round(tabbor)); 
    哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)成功.---Geovin Du(涂聚文)
  • 相关阅读:
    85 容器(十二)——队列与栈:LinkedList的光芒万丈
    84 关于数据结构中的添加与取出的方法:push pop poll offer add get...
    83 lambda表达式
    82 subList()方法于asList()的細節以及UnsupportedOperationException
    81 Javaassist——class文件的操作
    80 脚本引擎——js脚本引擎
    03 NoClassDefFoundError
    79 动态编译与动态运行
    78 反射——概念、类的各种信息的获取(类名,属性,方法...)
    002 为什么接口中可以同时使用public与default 修饰抽象方法?
  • 原文地址:https://www.cnblogs.com/geovindu/p/3026675.html
Copyright © 2011-2022 走看看