Reputation: 4987
Below is a sample of some code that is building a ListView. This is the first time that I have attempted to change the Color and Font of items in my ListView. The code below fills the ListView with no problems but, it does not use the Font. Can someone tell me what I am doing wrong here?
Font groupFont = new Font("Tahoma", 10.5f, FontStyle.Bold);
Font labelFont = new Font("Tahoma", 9.25f, FontStyle.Bold);
Font valueFont = new Font("Tahoma", 8.25f, FontStyle.Bold);
ListViewItem vesselName = new ListViewItem();
ListViewItem vesselNameLabel = new ListViewItem();
vesselName.SubItems.Add("Name: ", System.Drawing.Color.Blue, System.Drawing.Color.White, labelFont);
ListViewItem vesselNameValue = new ListViewItem();
vesselName.SubItems.Add(boat.boatname, Color.Black, Color.White, valueFont);
listViewVesselInformation.Items.Add(vesselName);
Upvotes: 2
Views: 1532
Reputation: 4987
Okay, setting the UseItemStyleForSubItems=false on the ListViewItem did the trick. The official MSFT information can be found at http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.listviewsubitem.font%28v=vs.90%29.aspx
Upvotes: 3