Er ... right ... well.... <cough> ...
Real life being what it is I may have to give this slightly less priority than, you know, earning a living, eating and so on so I'm not setting myself any deadlines but if you want to have a try at this on your own while I dilly and dally, this is how far I got last night on the listbox project I already talked about. There are added complications with the listview but it's basically the same principle ...
vb.net Code:
Private Sub ListBox1_DrawItem(sender As System.Object, e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox1.DrawItem
' Aim: to show the last letter of a selected 3 char string in red and bold font
Dim normal As String 'the normal bit
Dim bold As String 'the bold bit
Dim NewX = e.Bounds 'the drawing rectangle
Dim f = New Font(e.Font, FontStyle.Bold)
Dim Metric As SizeF 'this determines the display size of a string
e.Graphics.PageUnit = GraphicsUnit.Pixel 'probably it is already but just to make sure
Try
If e.Index = ListBox1.SelectedIndex Then
normal = ListBox1.Items(e.Index).ToString
bold = normal.Substring(2)
normal = normal.Substring(0, 2)
Metric = e.Graphics.MeasureString(normal, e.Font, e.Bounds.Width, StringFormat.GenericTypographic) ' size the rectangle for first section
NewX.X = e.Bounds.X + Metric.Width 'move draw position to end of first section rectangle
e.Graphics.DrawString(normal, e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault)
e.Graphics.DrawString(bold, f, Brushes.Red, NewX, StringFormat.GenericDefault)
Else
e.Graphics.DrawString(ListBox1.Items(e.Index).ToString, e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault) 'everything just as it usually is
End If
Catch
End Try
End Sub