Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ChingYen  
#1 Posted : Tuesday, April 8, 2008 10:53:57 AM(UTC)
ChingYen

Rank: Advanced Member

Groups: Member
Joined: 3/3/2008(UTC)
Posts: 185

Thanks: 8 times
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  
#2 Posted : Wednesday, April 9, 2008 10:15:49 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
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

Users browsing this topic
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.