Rank: Advanced Member Groups: Member
Joined: 3/3/2008 Posts: 46 Points: 138
|
Hi,
May I know is there anyway to check the font for the TextVObject style is available?
I try using code as in the subject, but seems like it's not part of the member...
We need this checking cuz sometimes, the code will jump into this kind of error
Font 'Aharoni' does not support style 'Regular'.(System.Drawing)
Please advice.
|
Rank: Advanced Member Groups: Administration
, Member
Joined: 1/31/2005 Posts: 385 Points: 400
|
Hello, The value of the TextVObject.Font property is ordinary System.Drawing.Font instance. As far as I know there is no built-in way to check whether specific style is supported by the font. However I think you may use something like that to perform the check: Code:
Private Function IsStyleSupported(ByRef familyName As String, _
ByRef style As System.Drawing.FontStyle) As Boolean
Dim result As Boolean = False
Try
Dim f As New Font(familyName, 10, style)
f.Dispose()
result = True
Catch ex As System.ArgumentException
End Try
Return result
End Function
Best wishes, Alex.
|