Click here to Skip to main content
11,427,946 members (62,214 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 21:41pm
Edited 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 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)

Advertise | Privacy | Mobile
Web01 | 2.8.150428.2 | 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