Main Site Documentation

TextFow formatting


#1

Hi !!

I’m trying to produce a file, contained in resources, that can be added to a text run.
When I include a bog standard text file the formatting is wrong… I have searched the internet but there is no real help.

i.e… endofline isn’t “0x10” as it is in ascii, I can’t write a help file to display… Tabs and LF and CR are all printed as an unprintable characters. I’ve tried XML but I can’t use this as a textrun.

Anyone?

Cheers Ian


#2

What are you trying to display this on?


#3

Can you post a bit of code? I can’t really suggest anything till I see what you’re trying to to do in code.


#4

If you look at the GHI demo on the information window…

The text is added as single textRuns.The textRun.add method also allows me to add a txt file from resources, but doesn’t allow basic text formatting


             // TextFlow component
            TextFlow textFlow = new TextFlow();
            TextRun  tr = new TextRun(Resources.GetString(Resources.StringResources.text),font,Color.White);
            textFlow.ScrollingStyle = ScrollingStyle.LineByLine;
            textFlow.HorizontalAlignment = HorizontalAlignment.Center;
            textFlow.VerticalAlignment = VerticalAlignment.Top;
            textFlow.TextAlignment = TextAlignment.Left;
            textFlow.SetMargin(10);
            textFlow.TextRuns.Add(tr);

This works but there is no formatting ie… no tabs, no end of line, no carriage return etc…
I want to know how to format the text… I’m creating a help page

Cheers Ian


#5

From the docs it looks like there is a class you add between TextRun’s to demonstrate that there should be a new line, and one for a new paragraph. I don’t believe that many Windows controls render the tab character.

You may need to try creating a new object from TextEmbeddedClass that implements a leading space.


#6

I am looking at the XML reader now… It might be an easier way to go.

Thanks anyway…

Cheers Ian