MFC CListBox

   CListBox in MFC is a powerful control. It can be used for displaying the normal text and even custom data like pictures. Whenever such custom behavior is needed, a new class has to be derived from CListBox and the MeasureItem and DrawItem functions should be over-ridden and the CListBox based control should be created [...]

   CListBox in MFC provides functions and data members to manipulate a list box control. This class can be over-ridden/manipulated in order to change the behavior of the list box to our needs. The project in this article illustrates an owner-draw list box that is used to list the colors and drawing text on the [...]

   CListBox is being used to display the Fonts installed in the local machine in this project with an owner-draw list box. The class uses an abstract object to draw the items. In this case a class derived from the abstract object is created to make the control list colors as in many other Owner [...]

   CListBox MFC class does not have its own way of handling a check box inside the list box. That is why MFC provides another class CCheckListBox which enables a programmer to embed check boxes inside a list box.    CCheckListBox is derived from CListBox with features to support check boxes inside the list box. [...]

   CListBox class as such does not give support for different fonts or colors. So whenever a programmer needs to use different fonts or colors, he should derive a class from CListBox and override the DrawItem & MeasureItem functions. The property ListBox Properties –> Styles tab –> OwnerDraw should be set as Fixed. The ListBox [...]

CListBox class can contain string data type as well as Icons. In fact in Windows all controls are considered to be a window with their own Message Maps, Screen formatting functions etc., Most of these controls are derived from the parent CWnd classes and hence inherit all the abilities as stated above. This article ” [...]