【发布时间】:2021-11-29 22:15:25
【问题描述】:
我想显示 ???? (WIDE-HEADED LEFTWARDS HEAVY BARB ARROW Symbol)在PrintDocument 中。它无法正确渲染;它只显示一个框。在 vb.net 4.6 中使用 Windows 窗体;视觉工作室 2017。
我知道我有正确的字符和字体,因为它在表单上的按钮中显示得很好。然而在 PrintPreviewDialog 中它不会正确呈现。我需要做什么?
Public WithEvents Doc As New PrintDocument
Public Sub ShowDialog()
'page settings
Me.Doc.DefaultPageSettings = ... set letter size, default printer, margins
Me.Doc.PrinterSettings = ...default printer
Me.Doc.DefaultPageSettings.PaperSize.RawKind = PaperKind.Letter
'show dialog
Dim dlgPreview As New PrintPreviewDialog
dlgPreview.Document = Me.Doc
dlgPreview.WindowState = FormWindowState.Maximized
dlgPreview.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) Handles Doc.PrintPage
Dim arrow As String = Char.ConvertFromUtf32(&H1F87A)
Dim f As New System.Drawing.Font("Microsoft Sans Serif", 11, FontStyle.Regular)
e.Graphics.DrawString(arrow, f, Brushes.Black, 100, 100)
End Sub
【问题讨论】:
-
在此处了解字体回退功能:How can a Label control display Japanese characters properly when the Font used doesn't support this language? -- 这适用于控件,将文本打印为图形不会导致字体回退。
-
使用Wingdings 字体。字符
&HE7. -
或
Segoe MDL2 Assets,字符&HF0D5。
标签: vb.net unicode printdocument