472,142 Members | 1,021 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

ListView - Items with non default ForeColor loose their coloringwhen selecting nothing?

I have a list view and a button that turns the currently selected item's
ForeColor to SystemColors.GrayText

The problem I'm having is that when the user clicks in white space, the
item becomes deselected and the ForeColor turns black (even though it's
still set to GrayText - stepped through to see if it was the case). If
I select a different item instead of selecting nothing the color stays
gray..

What would be causing this? Here's my code for turning the color gray:

private void btn_Delete_Click(object sender, System.EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
listView1.SelectedItems[0].ForeColor = SystemColors.GrayText;
}
}
Nov 20 '05 #1
0 1141

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Paddy | last post: by
2 posts views Thread by David Anderson | last post: by
3 posts views Thread by ¿ Mahesh Kumar | last post: by
1 post views Thread by Lars Netzel | last post: by
3 posts views Thread by Steve Long | last post: by
1 post views Thread by Mike Johnson | last post: by
5 posts views Thread by Jure Bogataj | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.