Unplanned
Last Updated: 19 Jun 2017 06:21 by ADMIN
ADMIN
Dimitar
Created on: 25 Mar 2016 09:10
Category: ChartView
Type: Bug Report
1
FIX. RadChartView - the title is not painted correctly when it contains html formatting and the chart is exported to image.
To reproduce:
- Use HTML- like text formatting in the chart title.
- Export the chart to image.
- The tags are shown in the text.

Workaround:
private void radButton1_Click(object sender, EventArgs e)
{
    radChartView1.ShowTitle = false;

    TextPrimitiveHtmlImpl impl = new TextPrimitiveHtmlImpl();
    TextParams textParams = this.radChartView1.ChartElement.TitleElement.TextParams;
    SizeF size = impl.MeasureOverride(new SizeF(500f, 200), textParams);

    using (MemoryStream stream = new MemoryStream())
    {
        radChartView1.ExportToImage(stream, new Size(500, 500 - (int)size.Height));

        Bitmap bmp = new Bitmap(500, 500);

        using (Graphics g = Graphics.FromImage(bmp))
        {
            g.Clear(Color.White);
            textParams.paintingRectangle = new RectangleF(Point.Empty, size);
            impl.PaintPrimitive(new RadGdiGraphics(g), textParams);
            g.DrawImage(Image.FromStream(stream), 0, size.Height, 500, 500 - size.Height);
        }

        bmp.Save(@"D:\xfile.bmp");
    }

    radChartView1.ShowTitle = true;
}
0 comments