Imports System.Windows.Forms
Imports System.Text
Imports System.Linq
Imports System.Drawing
Imports System.Data
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System
Partial Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
'添加字体
For Each fam As FontFamily In FontFamily.Families
ListBox1.Items.Add(fam.Name)
Next
'OwnerDrawVariable
ListBox1.DrawMode = DrawMode.OwnerDrawVariable
End Sub
Private Sub listBox1_DrawItem(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles ListBox1.DrawItem
e.DrawBackground()
e.Graphics.DrawString(ListBox1.Items(e.Index).ToString(), New Font(ListBox1.Items(e.Index).ToString(), 12), Brushes.Black, e.Bounds)
End Sub
Private Sub listBox1_MeasureItem(ByVal sender As Object, ByVal e As MeasureItemEventArgs) Handles ListBox1.MeasureItem
e.ItemHeight = 22
End Sub
End Class
暂时没有评论