Ahmed Alsafi
I have a right-to-left text and I want to print it starting from the right side of the print document. This is because printing from left-to-right gives me a varying position of my text according to the text size.How can I place my text in the print document to have it starting from a fixed position at the right of that document?
By Ahmed Alsafi in Windows Forms on Aug 17 2009
  • Ahmed Alsafi
    Aug, 2009 27

    Thanks god, I have finally found a solution to this problem.

    The idea is that instead of having the print document aligned from right to left ( no such property for the print document exists), I must format every string drawn in the document as follows:

    step 1: create a StringFormat instance:

    StringFormat sf = new StringFormat();

    step 2: assign the right to left direction to this instance:

    sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;

    step 3: use this format to draw the specified string (RK: f is a Font object and ptf is a PointF object. Review the DrawString method)

    e.Graphics.DrawString("any text", f, Brushes.Black, ptf, sf);

    Finally, my text is being printed starting from right to left

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS