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

PdfGraphicsAcroFormListBoxField Class

Represents a list box field.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v20.2.Drawing.dll


public class PdfGraphicsAcroFormListBoxField :


To create a list box field, call the PdfGraphicsAcroFormField.CreateListBox method with the specified the field name and field rectangle.

To add values to the list box, call one of the PdfGraphicsAcroFormChoiceField.AddValue overloaded methods.

You can also specify the list box field properties, for example, list box name, tooltip and appearance using PdfGraphicsAcroFormField.Name, PdfGraphicsAcroFormField.ToolTip, PdfGraphicsAcroFormField.Appearance properties.

To select an item of a list box by its export value, call the PdfGraphicsAcroFormChoiceField.SelectValue method using this value.

To add a list box field to PDF graphics, pass a PdfGraphicsAcroFormListBoxField object representing the list box field as a parameter to the PdfGraphics.AddFormField method. To access PdfGraphics, you need to reference the DevExpress.Pdf.Drawing assembly.

To render a page with the PDF graphics, call one of PdfDocumentProcessor.RenderNewPage overloaded methods.


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. 

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

                    ' 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.

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

            ' Add the field to the document.
        End Sub
    End Class
End Namespace
See Also