.NET

.NET

Reply
Valued Mentor
AubelecBE
Posts: 407
Registered: ‎01-27-2010
Message 1 of 1 (137 Views)

how to Create a System..... from Autodesk.AutoCAD....FontDescriptor

137 Views, 0 Replies
03-09-2012 05:24 AM

Sujet :

how to Create a System.drawing.font from  Autodesk.AutoCAD.GraphicsInterface.FontDescriptor

 

 

hi i can get a pathname of font from a FontDialog.

i put this information  :

 

Dim fontDialog1 As New System.Windows.Forms.FontDialog
With fontDialog1
If IsNothing(StyleEncours) = False Then
'remplissage dialog avant display
.Font = New System.Drawing.Font(StyleEncours.Font, 10)
End If

If fontDialog1.ShowDialog() <> System.Windows.Forms.DialogResult.Cancel Then
'création dun style acad tmp pour récup du path de la font
Dim str As TextStyleTableRecord = New TextStyleTableRecord()
str.Name = "ee"
str.Font = New Autodesk.AutoCAD.GraphicsInterface.FontDescriptor(.Font.Name, .Font.Bold, .Font.Italic, Nothing, Nothing)

Dim Path As String = str.FileName
str.Dispose()
str = Nothing
If Path = "" Then
MsgBox("Désolé cette font n'est pas reconnu par Autocad" & vbCrLf & _
"Font inutilisable, veuillez en choissir une autre", _
MsgBoxStyle.Information, "Information utilisateur")
Else

 this partial code use "StyleEncours" for populate befo show the fontdialog.

"StyleEncours" contain the path of the font. ie : "c:\windows\fonts\arialb.ttf"

 

so if this var is not nothing i need to populate the font dialog with a font of windows but i can retrieve the correct name of the font.

 

this part not working :

.Font = New System.Drawing.Font(StyleEncours.Font, 10)

i thing i need to retrieve the name of font  for do this :

.Font = New System.Drawing.Font("ArialB", 10)

 

thx

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.