.NET

.NET

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

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

134 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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.