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

[CONNECT C#] Create text with active text style

$
0
0

I am trying to create a text using the new .net API, but I cannot find out how to apply the active text style. 

What I have tried is to get active text style and create a TextBlock like this:

            DgnTextStyle style = DgnTextStyle.GetSettings(Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile());
            style.SetProperty(TextStyleProperty.Justification, (uint)TextElementJustification.CenterBaseline);
            TextBlock tb = new TextBlock(style, Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModel());

I have also tried to apply the text style using TextBlockProperties:

            TextBlockProperties tbp = new TextBlockProperties(Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModel());
            tbp.ApplyTextStyle(style, 1, true);
            tb.SetProperties(tbp);

But with both methods the active text style is not used. Font is always ENGENEERING and text size is always 0.5.

I suspect that the method I use to get active text style is not correct. Any help is appreciated.

regards
Frode Tørresdal


Viewing all articles
Browse latest Browse all 7260

Trending Articles