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

[Connect VBA] How do you set the justification on a text element prior to adding it to a model?

$
0
0

Hi,

When there is an existing text element, you can change the .textstyle.justification and then .rewrite and the justification is changed.  When I am creating a new element, I can change the justification for the new element, but when that element is added to the file, the justification is lost.

Sub TextTest()'Active settings used for creating the text text element
    ActiveSettings.TextStyle.Justification = msdTextJustificationLeftTop
    Dim NewText As TextElement
    Set NewText = CreateTextElement1(Nothing, "X", Point3dZero, Matrix3dIdentity)   'Active Justification should be LeftTop

    NewText.TextStyle.Justification = msdTextJustificationCenterCenter
    NewText.TextStyle.NodeJustification = msdTextJustificationCenterCenter
    
    ActiveModelReference.AddElement NewText
End Sub

The routine above sets active justification to LeftTop, creates a text element (LeftTop justification), changes the justification of that element to CenterCenter, and then adds the element to active model.  The added element has the justification set to LeftTop instead of CenterCenter.

I'm not sure if I am doing something wrong, or if this is a bug.  Can anyone help me out? 

--Thanks,
--Robert


Viewing all articles
Browse latest Browse all 4331


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