首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行vb.net代码时,在Windows2008服务器上不显示MICR符号

运行vb.net代码时,在Windows2008服务器上不显示MICR符号
EN

Stack Overflow用户
提问于 2020-07-03 17:41:05
回答 1查看 26关注 0票数 0

可执行文件已创建,然后在Windows 2008 Server和Windows 2016 Server上运行,但符号未在Windows 2008 Server上渲染。你能帮我解决这个问题吗?

代码语言:javascript
复制
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Text = "⑈" + "1234"
        Me.TextBox1.AutoSize = False
        Me.TextBox1.Height = 26
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox2.Text="⑆" + "5678"
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        '"files.encoding": "windows1252"
        TextBox3.Text = "⑇" + "9876"
    End Sub
End Class

EN

回答 1

Stack Overflow用户

发布于 2020-07-03 18:29:04

What are standard unicode fonts?暗示您必须在Server2008机器上将文本框的字体设置为Lucida Sans Unicode才能看到这些字形。

如下所示:

代码语言:javascript
复制
Private Function IsOldOS() As Boolean
    ' Regard Windows 7 and Windows Server 2008 (and earlier) as old operating systems.
    ' See https://stackoverflow.com/questions/2819934/detect-windows-version-in-net
    Return Environment.OSVersion.Version.Major < 6 OrElse (Environment.OSVersion.Version.Major = 6 AndAlso Environment.OSVersion.Version.Minor <= 1)
End Function

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    If IsOldOS() Then
        ' Use the Unicode font available on older machines.
        ' See https://stackoverflow.com/questions/9360394/what-are-standard-unicode-fonts
        Dim fnt = New System.Drawing.Font("Lucida Sans Unicode", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        For Each tb In {TextBox1, TextBox2, TextBox3}
            tb.Font = fnt
        Next
    End If

End Sub

如果需要避免文本框更改大小,则可能需要调整字体的大小。您可能希望更改所有控件的字体,以保持其外观一致。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62712706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档