.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfGraphicsAcroFormChoiceField.AddValue(String) Method

Adds an item to a combo box and list box using their display value.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v21.1.Drawing.dll

Declaration

public void AddValue(
    string displayValue
)

Parameters

Name Type Description
displayValue String

A String that is a value to be added to combo box and list box.

Remarks

The export value of an added item is equal to the display value.

Example

This example shows how to create a list box field and add it to a PDF document using the Document Creation API.

Imports DevExpress.Pdf
Imports System.Drawing

Namespace AddListBoxField
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            Using processor As New PdfDocumentProcessor()

                ' Create an empty document. 
                processor.CreateEmptyDocument("..\..\Result.pdf")

                ' Create graphics and draw a list box field.
                Using graphics As PdfGraphics = processor.CreateGraphics()
                    DrawListBoxField(graphics)

                    ' Render a page with graphics.
                    processor.RenderNewPage(PdfPaperSize.Letter, graphics)
                End Using
            End Using

        End Sub

        Private Shared Sub DrawListBoxField(ByVal graphics As PdfGraphics)

            ' Create a list box field specifying its name and location.
            Dim listBox As New PdfGraphicsAcroFormListBoxField("list box", New RectangleF(20, 20, 100, 120))

            ' Add values to the list box.
            listBox.AddValue("Blue")
            listBox.AddValue("Green")
            listBox.AddValue("Red")
            listBox.AddValue("Yellow")

            ' Specify list box appearance, text alignment, and select value. 
            listBox.Appearance.BackgroundColor = Color.Aqua
            listBox.TextAlignment = PdfAcroFormStringAlignment.Far
            listBox.SelectValue("Blue")

            ' Add the field to the document.
            graphics.AddFormField(listBox)
        End Sub
    End Class
End Namespace
See Also