Vb.net 如何在列表框中显示粗体项目?

Vb.net 如何在列表框中显示粗体项目?,vb.net,visual-studio,Vb.net,Visual Studio,我有以下代码: Private Sub ListBox1_DrawItem(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DrawItemEventArgs) _ Handles ListBox1.DrawItem ' Draw the background of the ListBox control for each item. e.DrawBackground() ' Define the

我有以下代码:

Private Sub ListBox1_DrawItem(ByVal sender As Object, _
 ByVal e As System.Windows.Forms.DrawItemEventArgs) _
 Handles ListBox1.DrawItem

    ' Draw the background of the ListBox control for each item.
    e.DrawBackground()

    ' Define the default color of the brush as black. 
    Dim myFontStyle As FontStyle = FontStyle.Bold
    ' Determine the color of the brush to draw each item based on    
    ' the index of the item to draw. 
    Select Case e.Index
        Case 0
            'Set Font to Bold
        Case 1
            'Set Font to Normal

    End Select

    ' Draw the current item text based on the current  
    ' Font and the custom brush settings.
    e.Graphics.DrawString(ListBox1.Items(e.Index).ToString(), _
    e.Font, e.Brush, e.Bounds, StringFormat.GenericDefault)
End Sub
我正试图使它,以便我可以大胆的列表框中的某些项目,但我遇到了很多麻烦。然而,我提到这会将列表项更改为不同的颜色,试图修改代码并没有取得任何成功。谁能给我指出正确的方向吗


非常感谢。

尝试创建字体变量:

Dim useFont as Font = e.Font
Select Case e.Index
    Case 0
        'Set Font to Bold
      useFont = New Font(e.Font, FontStyle.Bold)
End Select

' Draw the current item text based on the current  
' Font and the custom brush settings.
e.Graphics.DrawString(ListBox1.Items(e.Index).ToString(), _
useFont, e.Brush, e.Bounds, StringFormat.GenericDefault)

谢谢,正是我想要的。