Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
Dim y As Integer = 10
DrawIconSample(e.Graphics, y, SystemIcons.Application, _
"Application")
DrawIconSample(e.Graphics, y, SystemIcons.Asterisk, _
"Asterisk")
DrawIconSample(e.Graphics, y, SystemIcons.Error, _
"Error")
DrawIconSample(e.Graphics, y, SystemIcons.Exclamation, _
"Exclamation")
DrawIconSample(e.Graphics, y, SystemIcons.Hand, "Hand")
DrawIconSample(e.Graphics, y, SystemIcons.Information, _
"Information")
DrawIconSample(e.Graphics, y, SystemIcons.Question, _
"Question")
DrawIconSample(e.Graphics, y, SystemIcons.Warning, _
"Warning")
DrawIconSample(e.Graphics, y, SystemIcons.WinLogo, _
"WinLogo")
End Sub
Private Sub DrawIconSample(ByVal gr As Graphics, ByRef y As _
Integer, ByVal ico As Icon, ByVal ico_name As String)
gr.DrawIconUnstretched(ico, New Rectangle(10, y, _
ico.Width, ico.Height))
Dim text_y As Integer = y + (ico.Height - _
CInt(gr.MeasureString(ico_name, Me.Font).Height)) \ _
2
gr.DrawString(ico_name, Me.Font, Brushes.Black, _
ico.Width + 20, text_y)
y += ico.Height + 5
End Sub
|