BarCommandListBox Class
A ListBox that lists bar commands and is for use in a run-time customize dialog.
public class BarCommandListBox : ListBox, IDpiAwareElement
- Inheritance:
- Object Object
- Implements:
- 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
- Boolean:
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.
DrawMode
Gets or sets the drawing mode for the control.
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.
public int ItemHeight { get; set; }
Property Value
- Int32:
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.
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
- Boolean:
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 | System.Windows.Forms.DrawItemEventArgs | A |
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. |
Explicit Interface Implementations
IDpiAwareElement.DpiScaleChanged(SizeF)
Called when the DPI-based scale factor of the element changes.
void IDpiAwareElement.DpiScaleChanged(SizeF scaleFactor)
Parameter | Type | Description |
---|---|---|
scaleFactor | SizeF | The new scale factor where Width is applied to the x-axis, and Height is applied to the y-axis. |