In This Article

BarCommandListBox Class

A ListBox that lists bar commands and is for use in a run-time customize dialog.

[ToolboxBitmap(typeof(BarCommandListBox))]
public class BarCommandListBox : ListBox, IDisposable, IDpiAwareElement
Inheritance:
object MarshalByRefObject Component Control ListControl ListBox object
Implements:
IDisposable IDpiAwareElement

Constructors

BarCommandListBox()

Initializes a new instance of the BarCommandListBox class.

public BarCommandListBox()

Properties

AllowCustomizeDrag

Gets or sets whether to allow customize drags.

public bool AllowCustomizeDrag { get; set; }

Property Value

bool:

true if customize drags should be allowed; otherwise, false.

BarManager

Gets or sets the BarManager that manages the control.

public BarManager BarManager { get; set; }

Property Value

BarManager:

The BarManager that manages the control.

DefaultSize

Gets the default size of the control.

protected override Size DefaultSize { get; }

Property Value

Size:

The default Size of the control.

DrawMode

Gets or sets the drawing mode for the control.

[Browsable(false)]
public DrawMode DrawMode { get; set; }

Property Value

DrawMode:

One of the DrawMode values representing the mode for drawing the items of the control. The default is DrawMode.Normal.

Exceptions

Type Condition
InvalidEnumArgumentException

The value assigned to the property is not a member of the DrawMode enumeration.

ArgumentException

A multicolumn ListBox cannot have a variable-sized height.

ItemHeight

Gets the height of an item in the BarCommandListBox.

[Browsable(false)]
public int ItemHeight { get; set; }

Property Value

int:

The height, in pixels, of an item in the control.

Remarks

The height of items in this control is automatically determined based on current device DPI. Setting this value will have no effect.

SelectedCommand

Gets the selected BarCommand in the list.

[Browsable(false)]
public BarCommand SelectedCommand { get; }

Property Value

BarCommand:

The selected BarCommand in the list.

UseCommandName

Gets or sets whether to draw the command using the command name instead of the command text.

public bool UseCommandName { get; set; }

Property Value

bool:

true if the command should be drawn using the command name instead of the command text; otherwise, false.

Methods

OnDrawItem(DrawItemEventArgs)

Raises the DrawItem event.

protected override void OnDrawItem(DrawItemEventArgs e)
Parameter Type Description
e DrawItemEventArgs

A DrawItemEventArgs that contains the event data.

OnKeyPress(KeyPressEventArgs)

Raises the KeyPress event.

protected override void OnKeyPress(KeyPressEventArgs e)
Parameter Type Description
e KeyPressEventArgs

A KeyPressEventArgs that contains the event data.

OnMouseDown(MouseEventArgs)

Raises the MouseDown event.

protected override void OnMouseDown(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

OnMouseUp(MouseEventArgs)

Raises the MouseUp event.

protected override void OnMouseUp(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

WndProc(ref Message)

Occurs when a message is sent to the control.

protected override void WndProc(ref Message m)
Parameter Type Description
m Message

Information about the message.

Inherited Members