#region "Structure"
Public Structure RECT
Public X As Integer
Public Y As Integer
Public Width As Integer
Public Height As Integer
End Structure
#End region
#region "格式化文字"
Public Sub DrawStrings(ByVal g As Graphics, ByVal s As String, _
ByVal c As Color, ByVal f As String, ByVal size As Integer, _
ByVal rec As RECT)
' Dim flags As textformatflags
Dim fontFamily As New FontFamily(f)
Dim font As New Font(fontFamily, size, FontStyle.Bold, GraphicsUnit.Point)
Dim rect As New Rectangle(rec.X, rec.Y, rec.Width, rec.Height)
Dim stringFormat As New StringFormat
Dim solidBrush As New SolidBrush(c)
stringFormat.Alignment = StringAlignment.Center
stringFormat.LineAlignment = StringAlignment.Center
g.DrawString(s, font, solidBrush, RectangleF.op_Implicit(rect), stringFormat)
End Sub
#End region
#region "绘制渐变的背景"
Public Sub DrawbgRectangle(ByVal g As Graphics, ByVal startc As Color,_
ByVal endc as Color,ByVal rec As RECT)
Dim rc As New RectangleF(rec.X, rec.Y, rec.Width, rec.Height)
g.FillRectangle(New System.Drawing.Drawing2D.LinearGradientBrush(rc, _
startc, endc, Drawing2D.LinearGradientMode.Horizontal), rc)
End Sub
#end region
#region "Get AlL System Font"
Public Sub GetSystemFont()
Dim dt As New DataTable
Dim ds As DataRow
Me.ComboBox1.Items.Clear() '
For Each font As FontFamily In System.Drawing.FontFamily.Families
Me.ComboBox1.Items.Add(font.Name)
Next
End Sub
#End region