cete.dynamicpdf.pageelements.forms.listbox
ListBox
- Namespace: ceTe.DynamicPDF.PageElements.Forms
- Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll
Represents the list box field of a interactive forms.
public class ListBox : ChoiceField, ISerializable
Public Class ListBox
Inherits ChoiceField
Implements ISerializable
Inheritance: Object → PageElement → TaggablePageElement → FormElement → ChoiceField → ListBox
Implements: ISerializable
Licensing
This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
This example shows how to create an List Box and Add it to the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.Forms
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a PDF Page
Dim MyPage As Page = New Page(PageSize.Letter)
' Create an List Box
Dim MyListBox As ListBox = New ListBox("list", 5, 2, 100, 150)
Dim MyFont As OpenTypeFont = new OpenTypeFont("fontname")
MyListBox.Font = MyFont
MyListBox.Items.Add("One",true)
MyListBox.Items.Add("Two","ExportTwo",true)
MyListBox.Items.Add("Three")
MyListBox.Items.Add("Four")
MyListBox.Items.Add("Five")
MyListBox.BackgroundColor = RgbColor.AliceBlue
MyListBox.BorderColor = RgbColor.DarkMagenta
MyListBox.BorderStyle = BorderStyle.Dashed
MyListBox.Multiselect = true
MyListBox.ToolTip = "Select"
' Add the List Box to the page
MyPage.Elements.Add(MyListBox)
' Add pages to the document
MyDocument.Pages.Add(MyPage)
' Save the PDF document
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Forms;
using ceTe.DynamicPDF.Text;
public class Example
{
public static void CreatePDF(string outputPath, string fontPath)
{
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page(PageSize.Letter);
// Create an List Box
ListBox listBox = new ListBox("list", 5, 2, 100, 150);
OpenTypeFont myFont = new OpenTypeFont(fontPath);
listBox.Font = myFont;
listBox.Items.Add("One", true);
listBox.Items.Add("Two", "ExportTwo", true);
listBox.Items.Add("Three");
listBox.Items.Add("Four");
listBox.Items.Add("Five");
listBox.BackgroundColor = RgbColor.AliceBlue;
listBox.BorderColor = RgbColor.DarkMagenta;
listBox.BorderStyle = BorderStyle.Dashed;
listBox.Multiselect = true;
listBox.ToolTip = "Select";
// Add the List Box to the page
page.Elements.Add(listBox);
// Add pages to the document
document.Pages.Add(page);
// Save the PDF document
document.Draw(outputPath);
}
}
Remarks
For more details on list box fields take a look at the Interactive Forms topic.
Constructors
ListBox(String, Single, Single, Single, Single)
Creates a new instance of ListBox class.
public ListBox(string name, float x, float y, float width, float height)
Public Sub New (name As String, x As Single, y As Single, width As Single, height As Single)
Parameters
- name: String
Name of a list box.
- x: Single
X coordinate of a list box.
- y: Single
Y coordinate of a list box.
- width: Single
Width of a list box.
- height: Single
Height of a list box.
Properties
BackgroundColor
Gets or Sets the fill/background color of a form field. (Inherited from FormElement)
public RgbColor BackgroundColor { get; set; }
Public Property BackgroundColor As RgbColor
Property Value
BorderColor
Gets or Sets the border color of a form field. (Inherited from FormElement)
public DeviceColor BorderColor { get; set; }
Public Property BorderColor As DeviceColor
Property Value
BorderStyle
Gets or Sets the BorderStyle . (Inherited from FormElement)
public BorderStyle BorderStyle { get; set; }
Public Property BorderStyle As BorderStyle
Property Value
Font
Gets or Sets the font for the field. (Inherited from ChoiceField)
public Font Font { get; set; }
Public Property Font As Font
Property Value
FontSize
Gets or Sets the font size for the field. (Inherited from ChoiceField)
public float FontSize { get; set; }
Public Property FontSize As Single
Property Value
Height
Gets or Sets the height of a form field. (Inherited from FormElement)
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
Items
Gets the list of items for the ChoiceField . (Inherited from ChoiceField)
public ChoiceItemList Items { get; }
Public Property Items As ChoiceItemList
Property Value
MappingName
Gets or Sets an mapping name, of a form field. (Inherited from FormElement)
public string MappingName { get; set; }
Public Property MappingName As String
Property Value
Multiselect
Gets or Sets the multi select flag status of list box. If set, more than one of the field’s option items may be selected simultaneously; if clear, no more than one item at a time may be selected.
public bool Multiselect { get; set; }
Public Property Multiselect As Boolean
Property Value
Name
Gets or Sets the name of a form field. (Inherited from FormElement)
public string Name { get; set; }
Public Property Name As String
Property Value
NoExport
Gets or Sets the export state of a choice field. If set, the field will not be exported by a submit-form action. (Inherited from ChoiceField)
public bool NoExport { get; set; }
Public Property NoExport As Boolean
Property Value
Output
Gets or sets output options for the field. (Inherited from FormElement)
public FormFieldOutput Output { get; set; }
Public Property Output As FormFieldOutput
Property Value
Printable
Gets or Sets the form field printable on Pdf. By default its true. (Inherited from FormElement)
public bool Printable { get; set; }
Public Property Printable As Boolean
Property Value
ReaderEvents
Gets the reader events of the annotation. (Inherited from FormElement)
public AnnotationReaderEvents ReaderEvents { get; }
Public Property ReaderEvents As AnnotationReaderEvents
Property Value
ReadOnly
Gets or Sets the read only property status of the form field. (Inherited from FormElement)
public bool ReadOnly { get; set; }
Public Property ReadOnly As Boolean
Property Value
Rotate
Gets or Sets the angle of a form field. Rotation angle should be multiple of 90, default is 0. (Inherited from FormElement)
public int Rotate { get; set; }
Public Property Rotate As Int32
Property Value
Tag
Gets or sets the structure element of the form element. (Inherited from FormElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
TextColor
Gets or Sets the color of the text for the field. (Inherited from FormElement)
public DeviceColor TextColor { get; set; }
Public Property TextColor As DeviceColor
Property Value
ToolTip
Gets or Sets an alternate field name, of a form field. (Inherited from FormElement)
public string ToolTip { get; set; }
Public Property ToolTip As String
Property Value
Visible
Gets or Sets the form field visible on Pdf. By default its true. (Inherited from FormElement)
public bool Visible { get; set; }
Public Property Visible As Boolean
Property Value
Width
Gets or Sets the width of a form field. (Inherited from FormElement)
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or Sets the X coordinate of a form field. (Inherited from FormElement)
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or Sets the Y coordinate of a form field. (Inherited from FormElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the list box to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the list box's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .