Profile Picture

Text Orientation problem

Posted By Alexandr S. 14 Years Ago
Author
Message
Alexandr S.
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 23, Visits: 6
I want to draw a vertical text on the Chart. Here is the code of the INPaintCallback implementation:

public void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
{

string label = "test";
var yStyle = new NTextStyle(new Font("Arial", 12), Color.Red);
yStyle.Orientation = 90;
eventArgs.Graphics.PaintText(label, yStyle, new NPointF(100,100));
}


But text rendered horizontal. How can I rotate it?

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Alexander,

You'll have to change the graphics transform - for example:

public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
{
 string label = "test";
 var yStyle = new NTextStyle(new Font("Arial", 12), Color.Red);
 yStyle.Orientation = 90;


 GraphicsState state = eventArgs.Graphics.DeviceGraphics.Save();
 NPointF location = new NPointF(100, 100);

 eventArgs.Graphics.TranslateTransform(location.X, location.Y);
 eventArgs.Graphics.RotateTransform(90);
 eventArgs.Graphics.PaintText(label, yStyle, new NPointF(0, 0));
 eventArgs.Graphics.DeviceGraphics.Restore(state);
}



Best Regards,
Nevron Support Team



Alexandr S.
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 23, Visits: 6
It works Thank you!



Similar Topics


Reading This Topic