GrapeCity MultiRow Windows Forms Documentation
DropDownWidth Property (ComboBoxCell)
Example 


Gets or sets the width of the drop-down list portion of a combo box.
Syntax
<SRDescriptionAttribute("Indicates the width, in pixels, of the drop-down box in the ComboBoxCell.")>
<DefaultValueAttribute()>
<SRCategoryAttribute("Appearance")>
Public Overridable Property DropDownWidth As Integer
Dim instance As ComboBoxCell
Dim value As Integer
 
instance.DropDownWidth = value
 
value = instance.DropDownWidth
[SRDescription("Indicates the width, in pixels, of the drop-down box in the ComboBoxCell.")]
[DefaultValue()]
[SRCategory("Appearance")]
public virtual int DropDownWidth {get; set;}

Property Value

A System.Int32 value that represents the width, in pixels, of the drop-down list. The default is 0.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeExceptionThe assigned value is less than 0.
Remarks
The actual width of the drop-down list is always equal to or greater than the combo box's width. If the value of the DropDownWidth property is less than the combo box's width, the inner combo box uses the width of the cell as the drop-down width.
Example
The following code example shows how to customize a combo box cell's behavior or appearance. This code example is part of a larger example provided for the ComboBoxCell class.
ComboBoxCell CreateCommonComboBoxCell()
        {
            ComboBoxCell comboBoxCell = new ComboBoxCell();
            
            // The item listed in the drop down window. 
            comboBoxCell.Items.AddRange("Item2", "Item1", "Item3", "Item4", "Long Item to Make Ellipsis Show");

            // Sort items.
            comboBoxCell.Sorted = true;

            // Drop down window's width, in default. The value is equal to the cell's width.
            comboBoxCell.DropDownWidth = 100;

            // If not in edit mode, if text's length is bigger than cell's width, EllipsisString is shown.
            comboBoxCell.Ellipsis = MultiRowEllipsisMode.EllipsisEnd;

            return comboBoxCell;
        }
Private Function CreateCommonComboBoxCell() As ComboBoxCell
        Dim comboBoxCell As New ComboBoxCell()

        ' The item listed in the drop down window. 
        comboBoxCell.Items.AddRange("Item2", "Item1", "Item3", "Item4", "Long Item to Make Ellipsis Show")

        ' Sort items.
        comboBoxCell.Sorted = True

        ' Drop down window's width, in default. The value is equal to the cell's width.
        comboBoxCell.DropDownWidth = 100

        ' If not in edit mode, if text's length bigger than cell's width, EllipsisString is shown.
        comboBoxCell.Ellipsis = MultiRowEllipsisMode.EllipsisEnd

        Return comboBoxCell
    End Function
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ComboBoxCell Class
ComboBoxCell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.