Click here to Skip to main content
13,287,116 members (55,352 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Is it possible to achieve ,on list box selection(selected text background color) to show Default color or user defined color in transparent list box in MFC,C++ ?
Posted 3-Sep-12 21:41pm
Updated 3-Sep-12 23:11pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

try changing the color using:

//lbDemo is a ListBox control.
    protected void lbDemo_SelectedIndexChanged(object sender, EventArgs e)
        setItem(lbDemo, lbDemo.SelectedIndex);
    void setItem(ListBox lb,int SelectedIndex)
        foreach (ListItem li in lb.Items)
            li.Attributes.Add("style", "color:black");
        lb.Items[SelectedIndex].Attributes.Add("style", "color:blue");
Joan Murt 4-Sep-12 4:15am
MFC & C++?
rabhsaini 4-Sep-12 4:29am
Could you please suggest the same for tranparent list box using MFC?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171207.1 | Last Updated 4 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100