Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: How do you get the Font Name of an Enter Data Field?

$
0
0

[quote user="rpsmith"]

I have a design file with 1 Enter Data field element. How do you get the Font Name from this text string?

[/quote]

An enter-data field is part of a TextElement.  A TextElement has only one font: you can't have multiple fonts in a TextElement.  The answer to your question is: Get the font of the TextElement that stores the enter-data field.

However, there's no straightforward way to get the font of a TextElement.  You have to get its TextStyle, then obtain the font from the TextStyle...

Sub GetFont (ByVal oText As TextElement)
  Dim oStyle As TextStyle
  Set oStyle = oText.TextStyle
  If Not oStyle Is Nothing Then
    Dim oFont As Font
    Set oFont = oStyle.Font
    If oFont Is Nothing Then
       Debug.Print "Text style '" & oStyle.Name & "' has no font"
    Else
       Debug.Print "Text style  '" & oStyle.Name & "' uses font '" & oFont.Name & "'"
    End If
  End If
End Sub


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>