BinaryImageComboBox
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
BinaryImageComboBox | Initializes a new instance of BinaryImageComboBox class. |
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. |
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 | Gets or sets the color to be used for drawing the rectangle around the Image in the control. |
ComboListStyle | Gets or sets the style with which the control is to be initialized with. |
DesiredHeightForDrawingTheImages | Gets or sets the height, in logical (96 DPI) pixels, of the image drawn beside each item's text. |
DesiredWidthForDrawingTheImages | Gets or sets the width, in logical (96 DPI) pixels, of the image drawn beside each item's text. |
DrawRectangleAroundImage | Gets or sets whether a rectangle should be drawn around the image in the control. |
DropDownStyle | Provides a new implementation of the DropDownStyle property to ensure the property is always set to DropDownList style for BinaryImageComboBox class. |
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. |
Imagelist | Gets or sets an ImageList to be used for loading images from, to be displayed in the control alongside the text items. |
Items | Gets the control's Items collection. |
UseImageListForComboBox | Gets or sets whether the control should use an Imagelist for displaying images alongside the control's item text. |
Dispose | Refer to base class documentation. |
GetItemDisplayText | Returns the display text for one item, drawing its image as a side effect so that text and image stay aligned. |
OnDpiChangedAfterParent | Refer to base class documentation. |
OnFontChanged | Refer to base class documentation. |
OnHandleCreated | Refer to base class documentation. |
OnKeyDown | Raises the KeyDown event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior. |
OnKeyUp | Raises the KeyUp event. BinaryImageComboBox overrides it so the control's own handling runs alongside the base behavior. |
OnMeasureItem | Refer to base class documentation. |
OnSelectedIndexChanged | Refer to base class documentation. |
PaintControlWithData | This is a specialist painting override. Do not override this method with any special/custom code. |
RefreshPaint | This is a specialist painting override. Do not override this method with any special/custom code. |
SetData | This is a specialist painting override. Do not override this method with any special/custom code. |
WndProc | Refer to base class documentation. |
DriveSelectionChanged | Occurs when the control is in DriveList style, and the drive selection has changed. |
DropDownAboutToBeShown | This event is raised when the user clicks on the combobox and the drop-list window is about to be displayed. |
Constructors
BinaryImageComboBox
Initializes a new instance of BinaryImageComboBox class.
Properties
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.
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
The text strings shown beside the bitmaps, in the same order as the Bitmaps property. Setting it replaces the control's Items collection.
ColorForDrawingRectangleAroundImage
Gets or sets the color to be used for drawing the rectangle around the Image in the control.
ComboListStyle
Gets or sets the style with which the control is to be initialized with.
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
Gets or sets the height, in logical (96 DPI) pixels, of the image drawn beside each item's text.
DesiredWidthForDrawingTheImages
Gets or sets the width, in logical (96 DPI) pixels, of the image drawn beside each item's text.
DesiredHeightForDrawingTheImages describe, and centred in it.DrawRectangleAroundImage
Gets or sets whether a rectangle should be drawn around the image in the control.
DropDownStyle
Provides a new implementation of the DropDownStyle property to ensure the property is always set to DropDownList style for BinaryImageComboBox class.
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.
FontNameDisplayStyle enumeration for more details.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.
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
Gets the control's Items collection.
Value. An ObjectCollection.
UseImageListForComboBox
Gets or sets whether the control should use an Imagelist for displaying images alongside the control's item text.
Value. A bool value.
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
Refer to base class documentation.
GetItemDisplayText
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
Refer to base class documentation.
OnFontChanged
Refer to base class documentation.
OnHandleCreated
Refer to base class documentation.
OnKeyDown
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
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
Refer to base class documentation.
OnSelectedIndexChanged
Refer to base class documentation.
PaintControlWithData
This is a specialist painting override. Do not override this method with any special/custom code.
RefreshPaint
This is a specialist painting override. Do not override this method with any special/custom code.
SetData
This is a specialist painting override. Do not override this method with any special/custom code.
WndProc
Refer to base class documentation.
Events
DriveSelectionChanged
Occurs when the control is in DriveList style, and the drive selection has changed.
DropDownAboutToBeShown
This event is raised when the user clicks on the combobox and the drop-list window is about to be displayed.
DropDownProcessHandler for more details.