Exemplo n.º 1
0
        // add text box field for fields of the PDF document
        // with common parameters and default names.
        //
        internal PdfTextBox RenderTextBox(string text, Font font, RectangleF rc, Color back, string toolTip, bool multiline)
        {
            //  create
            string     name    = string.Format("ACFTB{0}", _textBoxCount + 1);
            PdfTextBox textBox = new PdfTextBox();

            //  default border
            // textBox.BorderWidth = 3f / 4;
            textBox.BorderStyle = FieldBorderStyle.Solid;
            textBox.BorderColor = SystemColors.ControlDarkDark;

            // parameters
            textBox.Font        = font;
            textBox.Name        = name;
            textBox.DefaultText = text;
            textBox.Text        = text;
            textBox.ToolTip     = string.IsNullOrEmpty(toolTip) ? string.Format("{0} ({1})", text, name) : toolTip;
            if (back != Color.Transparent && !back.IsEmpty)
            {
                textBox.BackColor = back;
            }
            textBox.IsMultiline = multiline;
            // add
            _c1pdf.AddField(textBox, rc);
            _textBoxCount++;

            // done
            return(textBox);
        }