我有一个WPF组合框这就是结合

Me.fontComboFast.ItemsSource = Fonts.SystemFontFamilies


<ComboBox x:Name="fontComboFast">
    <ComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel />
        </ItemsPanelTemplate>
    </ComboBox.ItemsPanel>
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding}" FontFamily="{Binding}" FontSize="15" Height="20"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

下面的异常发生。怎么会是最好的方式来清除的字体。SystemFontFamilies的任何无效的字体?

'file:///C:/程序文件(86)/共同文件/Adobe/唱/AssocCache/通用的。otf'的文件不符合预期的文件的格式规范。

有帮助吗?

解决方案

好吧,下面的样的帮助 样的字体选择

以下代码,也不符号字体,都不能用在我的情况:

Friend Function IsSymbolFont(ByVal FontFamily As FontFamily) As Boolean
    For Each typeface As Typeface In FontFamily.GetTypefaces()
        Dim Face As New GlyphTypeface

        Try
            If typeface.TryGetGlyphTypeface(Face) Then
                Return Face.Symbol
            End If
        Catch e As Exception
            Return True
        End Try

    Next
    Return False
End Function
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top