Click here to Skip to main content
11,648,785 members (84,925 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ MFC
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 20:41pm
Edited 3-Sep-12 22: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 at 4-Sep-12 4:15am
MFC & C++?
rabhsaini at 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
0 F-ES Sitecore 400
1 OriginalGriff 369
2 CPallini 340
3 DamithSL 295
4 Kornfeld Eliyahu Peter 245
0 OriginalGriff 1,512
1 Sergey Alexandrovich Kryukov 1,022
2 994
3 DamithSL 986
4 CPallini 945

Advertise | Privacy | Mobile
Web01 | 2.8.150804.4 | Last Updated 4 Sep 2012
Copyright © CodeProject, 1999-2015
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