I’m new to GoDiagram and I’m expermenting with text in your Demo example. There, you create two GoText nodes with specific bounds. I turned on the Bordered attribute to better see the bounds and made them larger. Autoresize is off. I set Alignment to MiddleCenter, expecting the line of text to shift to the geometric center of the text object. The text shifts horizontally toward the center, but it remains at the top of the entire text object. Similarly, Alignment = BottomRight shifts the text towards the right margin, but it doesn’t place the text at the bottom of the text object . Is it possible to align the text vertically within the text object? The way I read the User Guide, it should be possible: “Alignment - <span style=“font-size: 11pt; font-family: “Times New Roman”;”>how each line of
text is aligned within the whole text object.” There’s no mention of vertical restrictions.
<span style=“font-size: 11pt; font-family: “Times New Roman”;”>
There’s really just left, middle and right, all top aligned. It’s a reflection of the underlying .NET text capabilities. But, GoTextNode, for example, has a TopLeftMargin and BottomRightMargin that gets wrapped around the text box, so you can typically get what you want that way.
One more question re: text alignment experiments… I have a single GoBasicNode: AutoResizes = true, LabelSpot = Middle, MiddleLabelMargin = new SizeF(5, 5). The Shape changes as the Label text changes, which is great. However, with a single line of text, I can clearly see that the text center is actually slightly above the geometric Shape center. My guess is that GDI includes the leading in the text bounds (leading is the thin empty space between lines of text), even with a single line of text. This shifts the perceived center of the text up a bit.
I know that there’s no control over the vert. alignment of text and that GoBasicNode has no separate top / bottom margins. But isn’t there a hack of some kind that would either shift the Shape up or the Label down a bit to make the text look “properly” centered? I’ve read about LayoutChildren, but I don’t know how to do this without messing up the AutoResizes behavior, which I want preserved. Thanks.
Try this… put the characters Äy in one of your labels and see how it fills up the node.
Like I said, the text center is slightly above the box center. My guess is that GDI includes the leading (in red) in the text bounds. I’d like to drop the text a bit… LayoutChildren? Some Paint override?
What version of GoDiagram are you using? I think this changed in version 3.0.x.
By the way, is that your real e-mail address?
What I’m seeing with 4.0 is the bottom of the “y” touching the bottom line or 1 pixel width away from it (at different zoom levels).