Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Owner Drawn listView in C#!!!!!!!!

Status
Not open for further replies.

tomcoombs

Programmer
Aug 14, 2003
65
GB
I want to change the look of the Rows of a detailed view listView, but no owner drawn properties, what to do?? :)

All I want to do is highlight some rows with colour


Any ideas guys?

Tom
 
Change Color for an entire row in a list view:

// Assume we have a ListView with 3 Cols

string InsertItem[] = new string[3];
InsertItem[0] = "Text Here 1";
InsertItem[1] = "Text Here 2";
InsertItem[2] = "Text Here 3";

// Set up the color you'd like the row to be
// Im using 100 as an example, these are standard
// RGB color codes

int Red = 100; // Between 0 and 255
int Green = 100; // Between 0 and 255
int Blue = 100; // Between 0 and 255

// Create the object to insert
ListViewItem item = new ListViewItem(InsertItem);

// Set the back ground color of the row
item.BackColor = System.Drawing.Color.FromArgb(Red, Green, Blue);

// Add the row to your list view
YourListView.Items.Add(item);

Im pretty sure that you can use predefined colors rather
then specifying the colors as I did, but this gives u a
wider range of color choices. Hope this helps.

-Andrew R.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top