Click here to Skip to main content
Rate this: bad
good
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 21:41pm
Edited 3-Sep-12 23:11pm
v3

1 solution

Rate this: bad
good
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");
    }
  Permalink  
Comments
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 OriginalGriff 690
1 Maciej Los 280
2 Suvendu Shekhar Giri 229
3 Richard Deeming 195
4 Sascha Lefévre 164
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606


Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | 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