TextWidth() public method

public TextWidth ( string text ) : float
text string
return float
Exemplo n.º 1
0
    private static void ShowDescription(HPdfPage page, float x, float y,
            string text) {
        string buf;

        page.MoveTo(x, y - 10);
        page.LineTo(x, y + 10);
        page.MoveTo(x - 10, y);
        page.LineTo(x + 10, y);
        page.Stroke();

        page.SetFontAndSize(page.GetCurrentFont(), 8);
        page.SetRGBFill(0, 0, 0);

        page.BeginText();

        buf = "(x=" + x + ",y=" + y + ")";
        page.MoveTextPos(x - page.TextWidth(buf) - 5,
            y - 10);
        page.ShowText(buf);
        page.EndText();

        page.BeginText();
        page.MoveTextPos(x - 20, y - 25);
        page.ShowText(text);
        page.EndText();
    }
Exemplo n.º 2
0
    private static void ShowStripePattern (HPdfPage page, float x, float y) {
        int iy = 0;

        while (iy < 50) {
            page.SetRGBStroke(0.0f, 0.0f, 0.5f);
            page.SetLineWidth(1);
            page.MoveTo(x, y + iy);
            page.LineTo(x + page.TextWidth("ABCabc123"),
                    y + iy);
            page.Stroke();
            iy += 3;
        }

        page.SetLineWidth(2.5f);
    }