I'M creating a custom userlist for a chatroom program, and I'M trying to color the usernames on the list, but for some reason when I'M going through the name to color the names with the different colors when I measure the strings it keeps getting a space in between.
Code:Dim NameFont As New Font("Tahoma", 8, FontStyle.Bold, GraphicsUnit.Point) 'e.ItemRect is the rectangle I'M drawing in Dim UserName as String = "#c1#J#c2#o#c3#s#c4#h#c5#i#c6#e UserName = "#c9#" & UserName Dim StartPos As Double = e.ItemRect.Left + 56 Dim Spl() As String = Split(UserName, "#c") For Each Item As String In Spl Dim TColor As Color = ColorHelper.GetColorFromNumber(ColorHelper.ExtractColorNumber(Item)) Debug.WriteLine(TColor.ToString) Dim RT As String = ColorHelper.ExtractRealString(Item) Dim NBrush As New SolidBrush(TColor) e.Graphics.DrawString(RT, NameFont, NBrush, StartPos, e.ItemRect.Top + 2) 'Right here, there always seems to be a space inbetween when there shouldn't be. StartPos += e.Graphics.MeasureString(RT, NameFont).ToPointF.X Next




Reply With Quote