PrintDocument for WinForms | ComponentOne
C1.PrintDocument.8 Assembly / C1.C1Preview Namespace / RenderVerticalText Class
Members Example

In This Topic
    RenderVerticalText Class
    In This Topic
    Represents a run of vertical text in a C1PrintDocument.

    Designed primarily for rendering of Asian (e.g. Japanese) text in the traditional manner, vertically from right to left.

    Text is drawn using a single style (see RenderVerticalParagraph for multi-style text).

    Object Model
    RenderVerticalText Class
    Syntax
    'Declaration
     
    Public Class RenderVerticalText 
       Inherits RenderText
       Implements IDocumentLocationIStyleOwner 
    public class RenderVerticalText : RenderText, IDocumentLocationIStyleOwner  
    Remarks

    The default height and width of RenderVerticalText is auto. In particular, that means that text without line breaks will by default stretch downwards indefinitely. To make text wrap at the bottom, the height of the RenderVerticalText object must be explicitly set.

    Note that while the main use of this class is to output text in Asian languages, you can also print English text in this manner. To do so, add hex code 0xFEE0 to each English letter.

    Example
    The code below prints "CASINO ROYAL" and digits "12345" vertically:
    private static string ToVertical(string s)
    {
        StringBuilder sb = new StringBuilder(s.Length);
        for (int i = 0; i < s.Length; i++)
            if (s[i] == ' ')
                sb.Append(s[i]);
            else
                sb.Append((char)((int)s[i] + (0xFF10 - (int)'0')));
        return sb.ToString();
    }
                
    private C1PrintDocument CreateDocument()
    {
        C1PrintDocument doc = new C1PrintDocument();
        doc.FontHandling = FontHandling.EmbedActualFonts;
                
        RenderVerticalText rt;
                
        rt = new RenderVerticalText();
        rt.Style.Borders.All = LineDef.Default;
        rt.Style.Font = new Font("Arial", 18);
        rt.Text = ToVertical("CASINO ROYAL");
        doc.Body.Children.Add(rt);
                
        rt = new RenderVerticalText();
        rt.Style.Borders.All = LineDef.Default;
        rt.Style.Font = new Font("Arial", 18);
        rt.Text = ToVertical("Digits: (12345)");
        doc.Body.Children.Add(rt);
                
        return doc;
    }
    Inheritance Hierarchy

    System.Object
       C1.C1Preview.RenderObject
          C1.C1Preview.RenderTextBase
             C1.C1Preview.RenderText
                C1.C1Preview.RenderVerticalText

    See Also