Author:水如烟
注:字体文件在职X:/Program Files/Microsoft Visual Studio 8/Common7/IDE下,嵌为资源。
Imports
System.Windows.Forms
Imports System.Drawing
Namespace LzmTW
Friend Class VisualUiFont
Private gPrivateFontCollection As Drawing.Text.PrivateFontCollection
Private gFontFamily As FontFamily
Sub New ()
gPrivateFontCollection = New Drawing.Text.PrivateFontCollection
gPrivateFontCollection.AddFontFile( " Visualui.TTF " )
gFontFamily = New FontFamily( " Visualui " , gPrivateFontCollection)
End Sub
Public Sub SetFont( ByVal toolStripItem As ToolStripItem)
Dim mFont As Font = New Font(gFontFamily, toolStripItem.Font.Size)
toolStripItem.Font = mFont
End Sub
Public Sub SetFont( ByVal control As Control)
Dim mFont As Font = New Font(gFontFamily, control.Font.Size)
control.Font = mFont
End Sub
Public Shared Function Instance() As VisualUiFont
Return New VisualUiFont
End Function
End Class
End Namespace
Imports System.Drawing
Namespace LzmTW
Friend Class VisualUiFont
Private gPrivateFontCollection As Drawing.Text.PrivateFontCollection
Private gFontFamily As FontFamily
Sub New ()
gPrivateFontCollection = New Drawing.Text.PrivateFontCollection
gPrivateFontCollection.AddFontFile( " Visualui.TTF " )
gFontFamily = New FontFamily( " Visualui " , gPrivateFontCollection)
End Sub
Public Sub SetFont( ByVal toolStripItem As ToolStripItem)
Dim mFont As Font = New Font(gFontFamily, toolStripItem.Font.Size)
toolStripItem.Font = mFont
End Sub
Public Sub SetFont( ByVal control As Control)
Dim mFont As Font = New Font(gFontFamily, control.Font.Size)
control.Font = mFont
End Sub
Public Shared Function Instance() As VisualUiFont
Return New VisualUiFont
End Function
End Class
End Namespace