tChart1.Chart.ChartRect에서 차트 그리기 영역 좌표를 가져올 수 있습니다. 다음은 차트 범례를 이미지로 클리핑하는 예제입니다.
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Bitmap chartBmp;
private void InitializeChart()
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Bar()).FillSampleValues();
chartBmp = tChart1.Bitmap;
tChart1.GetLegendRect += tChart1_GetLegendRect;
}
void tChart1_GetLegendRect(object sender, Steema.TeeChart.GetLegendRectEventArgs e)
{
Rectangle cropRect = e.Rectangle;
Bitmap legendImg = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(legendImg))
{
g.DrawImage(chartBmp, new Rectangle(0, 0, legendImg.Width, legendImg.Height),
cropRect,
GraphicsUnit.Pixel);
}
legendImg.Save(@"c:\temp\legend.png");
}
예제 코드를 이용해 주셔서 감사합니다. – PRV