Forums

Welcome Guest Search | Active Topics | Members

obj.Font.IsStyleAvailable(FontStyle.Regular) Options
ChingYen
Posted: Tuesday, April 08, 2008 6:53:57 PM
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.
Alex Kon
Posted: Thursday, April 10, 2008 6:15:49 AM
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.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.