Code: Select all
private void button_Click(object sender, EventArgs e)
{
var chart = new TChart();
var pie = new Pie();
chart.Series.Add(pie);
pie.BevelPercent = 25;
pie.Brush.Color = Color.FromArgb(178, 29, 123, 99);
pie.Color = Color.FromArgb(68, 102, 163);
pie.EdgeStyle = Steema.TeeChart.Drawing.EdgeStyles.Curved;
pie.LabelMember = "Labels";
pie.Marks.ArrowLength = 21;
pie.Marks.Bevel.ColorOne = Color.FromArgb(255, 224, 192);
pie.Marks.Bevel.ColorTwo = Color.FromArgb(255, 128, 0);
pie.Marks.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.Raised;
pie.Marks.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.Lowered;
pie.Marks.Bevel.Width = 2;
pie.Marks.Callout.ArrowHead = ArrowHeadStyles.Solid;
pie.Marks.Callout.ArrowHeadSize = 10;
pie.Marks.Callout.Brush.Color = Color.Black;
pie.Marks.Callout.Distance = 1;
pie.Marks.Callout.Draw3D = false;
pie.Marks.Callout.Length = 21;
pie.Marks.Callout.Style = PointerStyles.Rectangle;
pie.Marks.Callout.Visible = false;
pie.Marks.Shadow.Height = 3;
pie.Marks.Shadow.Smooth = true;
pie.Marks.Shadow.Width = 3;
pie.MarksPie.LegSize = 0;
pie.MarksPie.VertCenter = false;
pie.Title = "pie";
pie.Transparency = 30;
pie.FillSampleValues(10);
var FImage = new PictureBox();
FImage.SizeMode = PictureBoxSizeMode.StretchImage;
FImage.Height = 300;
FImage.Width = 640;
chart.Height = FImage.Height;
chart.Width = FImage.Width;
FImage.Image = chart.Chart.Metafile(new MemoryStream(), chart.Chart, chart.Width, chart.Height, EmfType.EmfPlusOnly);
FImage.Image.Save(@"c:\image before chart is shown.emf");
using (var form = new Form())
{
form.Height = FImage.Height;
form.Width = FImage.Width;
form.Controls.Add(chart);
chart.Dock = DockStyle.Fill;
form.ShowDialog();
form.Controls.Remove(chart);
}
FImage.Image = chart.Chart.Metafile(new MemoryStream(), chart.Chart, chart.Width, chart.Height, EmfType.EmfPlusOnly);
FImage.Image.Save(@"c:\image after chart was shown.emf");
chart.Height = FImage.Height;
chart.Width = FImage.Width;
FImage.Image = chart.Chart.Metafile(new MemoryStream(), chart.Chart, chart.Width, chart.Height, EmfType.EmfPlusOnly);
FImage.Image.Save(@"c:\image after chart was shown and resized afterwards.emf");
}