简体   繁体   English

如何在C#WInforms中从右到左开始绘制printDocument?

[英]How to start drawing printDocument from Right to Left in C# WInforms ?

在此处输入图片说明

How to start drawing from right to left ? 如何从右到左开始绘制? الرقم التسلسلي should appear in the right الرقمالتسلسلي应该出现在右侧

static void Main(string[] args)
{
    PrintDocument p = new PrintDocument();
    p.PrintPage += new PrintPageEventHandler(PrintPage);
    p.Print();
}

static void PrintPage(object sender, PrintPageEventArgs e)
{
    string drawString = "إختبار الرسم";
    SolidBrush drawBrush = new SolidBrush(Color.Black);
    Font drawFont = new System.Drawing.Font("Arail", 16);
    RectangleF recAtZero = new RectangleF(0, 0, e.PageBounds.Width, 
    e.PageBounds.Height);
    StringFormat drawFormat = new StringFormat();

    drawFormat.FormatFlags = StringFormatFlags.DirectionRightToLeft;

    e.Graphics.DrawString(drawString, drawFont, drawBrush, recAtZero, 
    drawFormat);
    RectangleF recAtGreaterThantZero = new RectangleF(300, 0, 
    e.PageBounds.Width, e.PageBounds.Height);
    e.Graphics.DrawString(drawString, drawFont, drawBrush, 
    recAtGreaterThantZero, drawFormat);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM