The information in this article applies to:
SUMMARY
To set the foreground and background color of a list box control, set the
ForeColor and BackColor properties at either design time or run time. All
text in a list box uses the color set by the ForeColor property. The text
is printed against a background color set by the BackColor property.
MORE INFORMATION
You can display lines or words of different colors simultaneously in a list
box by using the following indirect technique:
Simulate the list box with a picture box control. You can store the desired text strings in an array of strings, and use the Print method to write the array entries into the picture box with different ForeColor properties. For example:
You can also add a vertical scroll bar next to the picture box. When the scroll bar is scrolled, your code needs to redraw the picture box. The ForeColor property of the picture box controls the current color used by the Print method. The picture box will not let you highlight text. NOTE: The BackColor method erases any pre-existing text on the picture control. ReferenceThe Windows Interface Guidelines for Software Design, Microsoft Press 1995.Additional query words: 3.00 4.00 vb4win vb432 listbox
Keywords : kb3rdparty PrgCtrlsCus PrgCtrlsStd PrgCtrlsThird |
Last Reviewed: June 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |