C# TeeChart-旋转多行注释(文本)工具产生错误结果

C# TeeChart-旋转多行注释(文本)工具产生错误结果,c#,.net,charts,teechart,C#,.net,Charts,Teechart,目前我正在处理一个需求,其中我需要rotate TeeChart的注释工具(.Net版本),该工具具有多行文本。我成功地更新了代码以旋转单行注释工具。下面可以找到其中的代码段 string[] s = tmp.Split(Texts.LineSeparator); int tmpCenterX, tmpCenterY; Point tmpP = new Point(0, 0); Rectangle r = shape.ShapeBounds;

目前我正在处理一个需求,其中我需要rotate TeeChart的注释工具(.Net版本),该工具具有多行文本。我成功地更新了代码以旋转单行注释工具。下面可以找到其中的代码段

string[] s = tmp.Split(Texts.LineSeparator);

        int tmpCenterX, tmpCenterY;
        Point tmpP = new Point(0, 0);
        Rectangle r = shape.ShapeBounds;
        if (Angle != 0)
        {
            Graphics3D.RectCenter(r, out tmpCenterX, out tmpCenterY);

            double tmp1 = Angle * Utils.PiStep;
            int tmpNumRow = 1;
            int tmpRowHeight = tmpHeight;
            double S = Math.Sin(tmp1);
            double C = Math.Cos(tmp1);

            int tmpY = tmpNumRow * tmpRowHeight - (r.Bottom - tmpCenterY);
            tmpP.X = Utils.Round(tmpCenterX - Utils.Round(tmpY * S));
            tmpP.Y = Utils.Round(tmpCenterY - Utils.Round(tmpY * C));

            tmpP.X = tmpCenterX;
            tmpP.Y = r.Top + tmpNumRow * tmpRowHeight;

            if (shape.Visible)
            {
                shape.DrawRectRotated(g, r, Utils.Round(Angle % 360), 0);
            }
        }

        for (int t = 1; t <= tmpN; t++)
        {

            if (TextAlign == StringAlignment.Center && tmpN > 1)
            {
                float auxW = g.Chart.Graphics3D.TextWidth(s[t - 1]);
                x = Utils.Round((shape.ShapeBounds.Left + shape.ShapeBounds.Right) / 2) - Utils.Round(auxW / 2);
            }


            if (Angle != 0)
            {
                Point rotatedPoint = RotatedPoint(r, (int)Angle);
                g.RotateLabel(rotatedPoint.X  , rotatedPoint.Y + tmpHeight * (t - 1), 0, s[t - 1], (float)Angle);
            }
            else
            {
                CalcTextXY(ref x, ref y);
                DrawString(g, x, y, t, tmpHeight, s);
            }
        }
string[]s=tmp.Split(text.LineSeparator);
国际TMPCentrex,TMPCentrey;
点tmpP=新点(0,0);
矩形r=shape.ShapeBounds;
如果(角度!=0)
{
图形3d.RectCenter(r,out-tmpCenterX,out-tmpCenterY);
双tmp1=角度*Utils.PiStep;
int tmpNumRow=1;
int tmpRowHeight=tmpHeight;
双S=Math.Sin(tmp1);
双C=数学Cos(tmp1);
int tmpY=tmpNumRow*tmpRowHeight-(右下角-tmpcentry);
tmpP.X=Utils.Round(tmpCenterX-Utils.Round(tmpY*S));
tmpP.Y=Utils.Round(tmpcentry-Utils.Round(tmpY*C));
tmpP.X=tmpCenterX;
tmpP.Y=r.Top+tmpNumRow*tmpRowHeight;
如果(形状可见)
{
形状旋转(g、r、Utils.圆形(角度%360),0);
}
}
对于(int t=1;t1)
{
float auxW=g.Chart.Graphics3D.TextWidth(s[t-1]);
x=Utils.Round((shape.ShapeBounds.Left+shape.ShapeBounds.Right)/2)-Utils.Round(auxW/2);
}
如果(角度!=0)
{
点旋转点=旋转点(r,(int)角度);
g、 RotateLabel(rotatedPoint.X,rotatedPoint.Y+tmpHeight*(t-1),0,s[t-1],(浮动)角度);
}
其他的
{
CalcTextXY(参考x,参考y);
抽绳(g、x、y、t、t、t、s);
}
}
但对于多行文本,此代码不起作用。请检查下面的屏幕截图,看是否有错误。


这方面的任何帮助都会大有裨益。提前感谢。

RotateLabel
这里对我来说是否正确:

private void TChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
  String tmp = "Multiline\nText\nAngle 45 Degree";

  g.RotateLabel(100, 150, tmp, 45);
}