Program,Life,Society.....

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::


在输出一个字符串到HTML时,想要传入System.Drawing.Font来控制字符串在HTML上的显示.

   Private Function GetFontString(ByVal Str As StringByVal WinFont As System.Drawing.Font) As String

        
Dim s As String

        s 
= "<span style=""font-family:" & WinFont.Name
        s 
+= ";font-size:" & WinFont.Size.ToString & ";"

        If WinFont.Bold Then s += "font-weight:bold;"

        If WinFont.Italic Then s += "font-style:italic;"

        If WinFont.Underline Or WinFont.Strikeout Then

            s 
+= "text-decoration:"

            If WinFont.Underline Then s += " underline"

            If WinFont.Strikeout Then s += " line-through"

        End If

        s 
+= """>" & Str & "</span>"

        Return s

    
End Function
posted on 2005-02-02 19:19  vuejs3  阅读(1018)  评论(0)    收藏  举报