Skip to main content

ComboBox

Version: 6.0

cete.dynamicpdf.pageelements.forms.combobox

ComboBox​

Represents the combo box field of a interactive forms. A combo box consisting of a drop list.

public class ComboBox : ChoiceField, ISerializable
Public Class ComboBox
Inherits ChoiceField
Implements ISerializable

Inheritance: Object → PageElement → TaggablePageElement → FormElement → ChoiceField → ComboBox

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 Combo 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 Combo Box Dim MyComboBox As ComboBox = New ComboBox("combo", 50, 75, 150, 25)
Dim MyFont As OpenTypeFont = new OpenTypeFont("fontname")
MyComboBox.Font = MyFont MyComboBox.Items.Add("One", true) MyComboBox.Items.Add("Two") MyComboBox.Items.Add("Three") MyComboBox.Items.Add("Four") MyComboBox.Items.Add("Five") MyComboBox.BackgroundColor = RgbColor.AliceBlue MyComboBox.BorderColor = RgbColor.DarkMagenta MyComboBox.Editable = true MyComboBox.ToolTip = "Select" ' Add the Combo Box to the page MyPage.Elements.Add(MyComboBox) ' 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.Forms;
using ceTe.DynamicPDF.Text;

class MyClass
{static void Main(){ // Create a PDF Document Document document = new Document(); // Create a PDF Page Page page = new Page( PageSize.Letter ); // Create an Combo Box ComboBox comboBox = new ComboBox( "combo", 50, 75, 150, 25 );
OpenTypeFont myFont = new OpenTypeFont("fontname");
comboBox.Font = myFont; comboBox.Items.Add( "One", true ); comboBox.Items.Add( "Two" ); comboBox.Items.Add( "Three" ); comboBox.Items.Add( "Four" ); comboBox.Items.Add( "Five" ); comboBox.BackgroundColor = RgbColor.AliceBlue; comboBox.BorderColor = RgbColor.DarkMagenta; comboBox.Editable = true; comboBox.ToolTip = "Select"; // Add the Combo Box to the page page.Elements.Add( comboBox ); // Add pages to the document document.Pages.Add( page ); // Save the PDF document document.Draw( @"C:\MyDocument.pdf" );}
}

Remarks​

For more details on combo box fields take a look at the Interactive Forms topic.

NOTE: This page element cannot be used within a table cell, or tranformation group.

Constructors​

ComboBox(String, Single, Single, Single, Single)​

Creates a new instance of ComboBox class.

public ComboBox(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 of a combo box.

X coordinate of a combo box.

Y coordinate of a combo box.

Width of a combo box.

Height of a combo 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​

RgbColor

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​

DeviceColor

BorderStyle​

Gets or Sets the BorderStyle . (Inherited from FormElement)

public BorderStyle BorderStyle { get; set; }
Public Property BorderStyle As BorderStyle

Property Value​

BorderStyle

Count​

Gets the number of items available in the item list. (Inherited from ChoiceField)

public int Count { get; }
Public Property Count As Int32

Property Value​

Int32

DefaultChoice​

Gets or Sets the default choice of a choice field. The choice set, should be one of the item in the item list. If not the last item will be the default choice. (Inherited from ChoiceField)

public string DefaultChoice { get; set; }
Public Property DefaultChoice As String

Property Value​

String

Editable​

Gets or Sets the editable state of a combo box. If set, the combo box includes an editable text box as well as a drop list; if clear, it includes only a drop list.

public bool Editable { get; set; }
Public Property Editable As Boolean

Property Value​

Boolean

ExportValue​

Gets or Sets the value entry identifies the item currently selected in the choice field. (Inherited from ChoiceField)

public string ExportValue { get; set; }
Public Property ExportValue As String

Property Value​

String

Font​

Gets or Sets the font for the field. (Inherited from ChoiceField)

public Font Font { get; set; }
Public Property Font As Font

Property Value​

Font

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​

Single

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​

Single

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​

String

Items​

Gets the list of items for the ChoiceField . (Inherited from ChoiceField)

public ChoiceItemList Items { get; }
Public Property Items As ChoiceItemList

Property Value​

ChoiceItemList

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​

String

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​

String

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​

Boolean

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​

Boolean

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​

Boolean

Required​

Gets or Sets the value specifying the required state of a field. If set, the field must have a value at the time it is exported by a submit-form action.

public bool Required { get; set; }
Public Property Required As Boolean

Property Value​

Boolean

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​

Int32

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​

Tag

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​

Int32

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​

DeviceColor

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​

String

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​

Boolean

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​

Single

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​

Single

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​

Single

Methods​

AddItem(String)​

Adds the item to the list. No duplicate items are allowed. (Inherited from ChoiceField)

public void AddItem(string item)
Sub AddItem(item As String)

Parameters​

Item to be added to the list.

Draw(PageWriter)​

Draws the combo box to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the combo 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​

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 .

GetItem(Int32)​

Gets the item from the items list with a given index. (Inherited from ChoiceField)

public string GetItem(int index)
Function GetItem(index As Integer) As String

Parameters​

Index of the item.

Returns​

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.

IndexOf(String)​

Gets the index of a item. (Inherited from ChoiceField)

public int IndexOf(string item)
Function IndexOf(item As String) As Integer

Parameters​

An item.

Returns​

Remove(Int32)​

Removes the item from the list. (Inherited from ChoiceField)

public void Remove(int index)
Sub Remove(index As Integer)

Parameters​

Item index to be removed from the list.

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 .

See Also​

ceTe.DynamicPDF.PageElements.Forms