HypernovaDesktop Components · docs
Binarymission
WinFormsCombo Box › BinaryImageComboBox

BinaryImageComboBox

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.ListControls

BinaryImageComboBox - Specialist ComboBox class for handling ComboBox text with Image support.

public class BinaryImageComboBox : BinaryComboBox

Inherits from / implements: BinaryComboBox

Remarks

BinaryImageComboBox class represents the specialist class for handling ComboBox text with Image support.
Whenever you want to handle just text based data (i.e., not dealing with Image support alongside text), you can use BinaryTextComboBox class.
If you need to use Images alongside the ComboBox text data, you can use this class.
BinaryImageComboBox class is a typical .NET ComboBox class, except that it provides the following additional features:-
1. Ability to fully support "Control painting" with custom colors.
Also, the control exposes properties to smoothen the colors when painting the control, its borders and its item hovering/selection colors.
2. Mouse hovering effects.
3. Direct support for displaying user specified Images alongside the ComboBox text.
4. Direct support for displaying System Drivelist box and Fontlist comboBox.
Refer to ComboListStyle for more details for this feature.

Members at a glance

BinaryImageComboBoxInitializes a new instance of BinaryImageComboBox class.
BitmapsGets or sets an array of Bitmap(s) to be used for loading images from, to be displayed in the control alongside the text items.
BitmapsAssociatedTextThe text strings shown beside the bitmaps, in the same order as the Bitmaps property. Setting it replaces the control's Items collection.
ColorForDrawingRectangleAroundImageGets or sets the color to be used for drawing the rectangle around the Image in the control.
ComboListStyleGets or sets the style with which the control is to be initialized with.
DesiredHeightForDrawingTheImagesGets or sets the height, in logical (96 DPI) pixels, of the image drawn beside each item's text.
DesiredWidthForDrawingTheImagesGets or sets the width, in logical (96 DPI) pixels, of the image drawn beside each item's text.
DrawRectangleAroundImageGets or sets whether a rectangle should be drawn around the image in the control.
DropDownStyleProvides a new implementation of the DropDownStyle property to ensure the property is always set to DropDownList style for BinaryImageComboBox class.
FontDisplayStyleGets or sets the display type to be used for displaying various font names in the system, when using the BinaryImageComboBox class with ComboListStyle's FontList mode.
ImagelistGets or sets an ImageList to be used for loading images from, to be displayed in the control alongside the text items.
ItemsGets the control's Items collection.
UseImageListForComboBoxGets or sets whether the control should use an Imagelist for displaying images alongside the control's item text.
DisposeRefer to base class documentation.
GetItemDisplayTextReturns the display text for one item, drawing its image as a side effect so that text and image stay aligned.
OnDpiChangedAfterParentRefer to base class documentation.
OnFontChangedRefer to base class documentation.
OnHandleCreatedRefer to base class documentation.
OnKeyDownRaises the KeyDown event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior.
OnKeyUpRaises the KeyUp event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior.
OnMeasureItemRefer to base class documentation.
OnSelectedIndexChangedRefer to base class documentation.
PaintControlWithDataThis is a specialist painting override. Do not override this method with any special/custom code.
RefreshPaintThis is a specialist painting override. Do not override this method with any special/custom code.
SetDataThis is a specialist painting override. Do not override this method with any special/custom code.
WndProcRefer to base class documentation.
DriveSelectionChangedOccurs when the control is in DriveList style, and the drive selection has changed.
DropDownAboutToBeShownThis event is raised when the user clicks on the combobox and the drop-list window is about to be displayed.

Constructors

BinaryImageComboBox

public BinaryImageComboBox()

Initializes a new instance of BinaryImageComboBox class.

Properties

Bitmaps

public Bitmap[] Bitmaps

Gets or sets an array of Bitmap(s) to be used for loading images from, to be displayed in the control alongside the text items.

Value. A Bitmap array.

The control supports displaying Images alongside the text items.
There are two ways of setting the images to be used for displaying in the control.
1. By using an Imagelist.
You could initialize an ImageList object with a set of Images and then use that imagelist as the images source.

2. By specifying an array of Bitmaps (at run-time).
When you want to set the images at run-time, this property comes handy.
You should initialize an array of Bitmaps and set this property with that array.
Whichever method you use, remember that the text strings will be loaded from the control's Items collection.
When setting the Bitmaps property, you could also set the BitmapsAssociatedText property to set the text strings.
Remember that when you set the BitmapsAssociatedText property, the control's Items collection will be cleared and the new String array elements will be added to the Control's Items collection.

BitmapsAssociatedText

public string[] BitmapsAssociatedText

The text strings shown beside the bitmaps, in the same order as the Bitmaps property. Setting it replaces the control's Items collection.

ColorForDrawingRectangleAroundImage

public Color ColorForDrawingRectangleAroundImage

Gets or sets the color to be used for drawing the rectangle around the Image in the control.

ComboListStyle

public ListStyle ComboListStyle

Gets or sets the style with which the control is to be initialized with.

BinaryImageComboBox directly supports constructing a ready to use DriveList and FontList comboboxes.
By setting this property with an appropriate style value from ListStyle, you can construct a specially styled combobox control.

Important note: By default, BinaryImageComboBox ComboListStyle is set to Standard style.
Once an instance of this object has been set to either FontList or DriveList style, you cannot revert back that particular instance to the Standard style.
Even if you did, the Items collection data would be lost.

DesiredHeightForDrawingTheImages

public int DesiredHeightForDrawingTheImages

Gets or sets the height, in logical (96 DPI) pixels, of the image drawn beside each item's text.

Setting it makes every item row tall enough for an image of this height with a two-pixel margin above and below it, or for a line of text if that is taller, and the closed control grows with the rows. Windows limits a combo box row to 255 device pixels; on a display scaled far enough for a row to reach that, the images are drawn smaller to fit, keeping their shape.

DesiredWidthForDrawingTheImages

public int DesiredWidthForDrawingTheImages

Gets or sets the width, in logical (96 DPI) pixels, of the image drawn beside each item's text.

An image keeps its shape: it is scaled to fit the box this property and DesiredHeightForDrawingTheImages describe, and centred in it.

DrawRectangleAroundImage

public bool DrawRectangleAroundImage

Gets or sets whether a rectangle should be drawn around the image in the control.

DropDownStyle

public new ComboBoxStyle DropDownStyle

Provides a new implementation of the DropDownStyle property to ensure the property is always set to DropDownList style for BinaryImageComboBox class.

FontDisplayStyle

public FontNameDisplayStyle FontDisplayStyle

Gets or sets the display type to be used for displaying various font names in the system, when using the BinaryImageComboBox class with ComboListStyle's FontList mode.

The default value is FontNameDisplayStyle.DisplayUsingControlFont . Please refer to FontNameDisplayStyle enumeration for more details.

Imagelist

public ImageList Imagelist

Gets or sets an ImageList to be used for loading images from, to be displayed in the control alongside the text items.

Value. An ImageList object.

The control supports displaying Images alongside the text items.
There are two ways of setting the images to be used for displaying in the control.
1. By using an Imagelist.
You could initialize an ImageList object with a set of Images and then use that imagelist as the images source.

2. By specifying an array of Bitmaps (at run-time).
When you want to set the images at run-time, this property comes handy.
You should initialize an array of Bitmaps and set this property with that array.
Whichever method you use, remember that the text strings will be loaded from the control's Items collection.
When setting the Bitmaps property, you could also set the BitmapsAssociatedText property to set the text strings.
Remember that when you set the BitmapsAssociatedText property, the control's Items collection will be cleared and the new String array elements will be added to the Control's Items collection.

Items

public new ComboBox.ObjectCollection Items

Gets the control's Items collection.

Value. An ObjectCollection.

UseImageListForComboBox

public bool UseImageListForComboBox

Gets or sets whether the control should use an Imagelist for displaying images alongside the control's item text.

Value. A bool value.

The control supports using an array of Bitmaps or an ImagelList, for displaying images alongside the item text.
If you want the control to use an ImageList object to load images from, then set this property to true.
Or else if you want the control to use a specified array of Bitmaps along with a string array of text strings, then set this property to false and accordingly set the Bitmaps and BitmapsAssociatedText properties to display images in the control.
By default, this property is set to false.

Methods

Dispose

protected override void Dispose(bool disposing)

Refer to base class documentation.

GetItemDisplayText

protected string GetItemDisplayText(Graphics g, Brush brush, int index)

Returns the display text for one item, drawing its image as a side effect so that text and image stay aligned.

g
The surface to draw on.
brush
The brush the text will be drawn with.
index
The item to read.

Returns. The text to draw for that item.

OnDpiChangedAfterParent

protected override void OnDpiChangedAfterParent(EventArgs e)

Refer to base class documentation.

OnFontChanged

protected override void OnFontChanged(EventArgs e)

Refer to base class documentation.

OnHandleCreated

protected override void OnHandleCreated(EventArgs e)

Refer to base class documentation.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

Raises the KeyDown event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnKeyUp

protected override void OnKeyUp(KeyEventArgs e)

Raises the KeyUp event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnMeasureItem

protected override void OnMeasureItem(MeasureItemEventArgs e)

Refer to base class documentation.

OnSelectedIndexChanged

protected override void OnSelectedIndexChanged(EventArgs e)

Refer to base class documentation.

PaintControlWithData

protected override void PaintControlWithData(Graphics g, Rectangle bounds, int Index, bool ifSelected, bool toEdit)

This is a specialist painting override. Do not override this method with any special/custom code.

RefreshPaint

protected override void RefreshPaint(Graphics g, Rectangle bounds, int Index, bool ifSelected, bool toEdit)

This is a specialist painting override. Do not override this method with any special/custom code.

SetData

protected override void SetData()

This is a specialist painting override. Do not override this method with any special/custom code.

WndProc

protected override void WndProc(ref System.Windows.Forms.Message m)

Refer to base class documentation.

Events

DriveSelectionChanged

public event DriveSelectionChangeHandler DriveSelectionChanged

Occurs when the control is in DriveList style, and the drive selection has changed.

DropDownAboutToBeShown

public event DropDownProcessHandler DropDownAboutToBeShown

This event is raised when the user clicks on the combobox and the drop-list window is about to be displayed.

Refer to the delegate DropDownProcessHandler for more details.