I'm using V8.0.0.5 in MSVC 2008, trying to position the legend using the custom position settings. I would like to align the right side of the legend with something, say, the right side of the chart. I need the width of the legend when I draw it in its new location, but ShapeBounds returns the previous width which may include clipping or use a different font. Is there a way of determining the size of the legend box before I draw it?
Thanks,
JBell
custom legend bounds before drawing
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi JBell,
You can use this code in form's initialization:
And implement chart's OnAfterDraw event like this:
You can use this code in form's initialization:
Code: Select all
m_Chart1.GetLegend().SetCustomPosition(true);
m_Chart1.GetEnvironment().InternalRepaint();
Code: Select all
int width = m_Chart1.GetLegend().GetShapeBounds().GetRight() -
m_Chart1.GetLegend().GetShapeBounds().GetLeft();
int left = m_Chart1.GetAxis().GetBottom().GetIEndPos() - width;
m_Chart1.GetLegend().SetLeft(left);
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |