Controlling GoText rendering

Hi Guys,

I want to trim the text of my GoText object according to a different rectangle and not the default (bounding rectangle). The reason is that I need to put a 16X16 icon i n the right side of the GoTextNode so the label (GoText) should be trimmed 16 pixels shorter.



Hope the question was clear



Thank you,



Adi Barda

Set AutoResizes and AutoScales to false, Clipping to be true. StringTrimming sets the trimming behavior.



but that won’t make more room for the icon, since you have to make the Label.Width smaller to get the trimming, and then the node will make itself smaller to wrap the text.



you could set the TopLeftMargin and BottomRightMargin on GoTextNode to make room for the icon.

Thank you for the answer Jake.

However when I use the this.BottomRightMargin = new SizeF(16, 16); as you suggested (this = GoTextNode) the label is disappeared totally when it has long text while I expect it to be trimmed to the nearest character (this.Label.StringTrimming = StringTrimming.EllipsisCharacter;)



You have AutoResize = false? If you are going to add margin to give yourself room for an icon, make AutoResize=true and let the full label show.

Jake,

If I make GoTextNode.AutoResize=true it works fine except my cubes can get very big (too big…). Is there a way to limit the size of the label to some maximum width?



Thanks,

Adi

Try setting GoText.Wrapping to true and GoText.WrappingWidth to the limit you would like.

This helps limit the width but the text is wrapped on multi line which is not good for our design. I need it to be trimmed. I think the best option is to inherit from GoText and control the paint function but this raises new issues (rendering in selection mode etc)



p.s I put this.Label.Multiline = false; but it didn’t help

OK, if you don’t want to wrap the text, the best thing to do is to override your node’s LayoutChildren method and make sure the Width of the GoText is no larger than you like. (Remember that GoText.Clipping must be true.)

I think you should do this before calling the base.LayoutChildren method.

By the way, GoText.Multiline controls whether it shows additional logical lines of text as determined by the presence of newlines in the string.

Thanks Guys,

this solved my issue



Regarding the multiLine - I saw the rendering behavior you mentioned using reflector but I thought maybe it might help me with the wrapping issue as well.



Anyway, now its OK.



thanks