Text

From Microstation VBA Wiki
Revision as of 14:53, 5 August 2010 by Ted (talk | contribs) (Created page with 'Placing text is much more dependent on ActiveSettings, so the command itself is pretty simple. It involves setting up a point (like lines or cells) and a rotation matrix,…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Placing text is much more dependent on ActiveSettings, so the command itself is pretty simple. It involves setting up a point (like lines or cells) and a rotation matrix, and giving the text to be placed, but otherwise most of the settings are stored in a property of ActiveSettings called TextStyle, which itself has a number of properties like Width, Height, and Justification.

First you have to set up a variable to hold the text element, matrix and text string:

Dim oText as TextElement
Dim oMatrix as Matrix3d
Dim strText as String
ActiveSettings.TextStyle.Justification = msdTextJustificationCenterBottom
ActiveSettings.TextStyle.Height = 2 * sca
ActiveSettings.TextStyle.Width = 2 * sca

Then you store the element in your TextElement variable and add it to the drawing:

Set oText = CreateTextElement1(Nothing, strText, ptStart, Matrix3dIdentity)
ActiveModelReference.AddElement oText