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 an instance of the class.

public BarCommandListBox()

Properties

AllowCustomizeDrag

Indicates whether to allow customize drags.

public bool AllowCustomizeDrag { get; set; }

Property Value

bool:

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

BarManager

The BarManager that manages the control.

public BarManager? BarManager { get; set; }

Property Value

BarManager

DefaultSize

The default size of the control.

protected override Size DefaultSize { get; }

Property Value

Size

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

The height of an item in the BarCommandListBox.

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

Property Value

int

Remarks

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

SelectedCommand

The selected BarCommand in the list.

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

Property Value

BarCommand

UseCommandName

Indicates 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)

The list's window procedure.

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

A Windows Message Object.

Inherited Members

Extension Methods