PdfGraphicsAcroFormChoiceField.AddValue(String) Method
Adds an item to a combo box and list box using their display value.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v18.2.Drawing.dll
Declaration
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-add-a-list-box-field-to-a-document-t494219
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
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AddValue(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.