Hi Steffen,
You mentioned you were moving to WPF earlier; in the WPF control there's ShapeNode.TextRotationAngle property you could use for this. We'll try to implement TextRotationAngle in next Windows Forms diagram release as well.
If you don't use polygonal layout but set text area only for positioning the text rectangle, you could override DrawLocal to flip text like this:
class MyNode : ShapeNode
{
public override void DrawLocal(IGraphics graphics, RenderOptions options)
{
var angle = RotationAngle;
if (angle < 0)
angle += 360;
if (angle > 90 && angle < 270)
{
// draw standard graphics except text
options.EnableText = false;
base.DrawLocal(graphics, options);
options.EnableText = true;
// get text area's bounding rect
var textShape = new Shape(this.Shape.TextArea, FillMode.Winding);
var textPath = textShape.GetRenderingPath(GetLocalBounds(), 0, 0, null);
var textBounds = textPath.GetBounds();
var centerX = textBounds.Width / 2;
var centerY = textBounds.Height / 2;
// flip text vertically
var state = graphics.Save();
graphics.TranslateTransform(centerX, centerY);
graphics.ScaleTransform(-1, -1);
graphics.TranslateTransform(-centerX, -centerY);
graphics.DrawString(Text, EffectiveFont, Brushes.Black, textBounds, TextFormat);
graphics.Restore(state);
}
else
{
base.DrawLocal(graphics, options);
}
}
}
private void test()
{
MyNode node0 = new MyNode();
node0.Bounds = new RectangleF(30, 30, 50, 50);
diagram.Nodes.Add(node0);
// display text in left half
node0.Shape = new Shape(Shapes.Rectangle.Outline, null, new[]
{
new LineTemplate(0, 0, 50, 0),
new LineTemplate(50, 0, 50, 100),
new LineTemplate(50, 100, 0, 100),
new LineTemplate(0, 100, 0, 0)
}, FillMode.Winding);
node0.EnabledHandles = AdjustmentHandles.All;
node0.RotateText = true;
node0.Text = "node0.EnabledHandles = AdjustmentHandles.All; node0.RotateText = true;";
node0.TextFormat.LineAlignment = StringAlignment.Center;
}
I hope that helps,
Stoyan