Get RadCartesianChart from Grid (8x3) issue when organizing
im has a grid of 8x3 lines and col.below to get a RadCartesianChart and it creates an image on disk with the "ExportCHARTtoBMP" function
for (int row = 0; row < (chartgridimage.RowDefinitions.Count())-1; row++)
for (int column = 0; column < chartgridimage.ColumnDefinitions.Count(); column++)
{
RadCartesianChart chart = chartgridimage.ChildrenOfType<RadCartesianChart>().FirstOrDefault(e => Grid.GetRow(e) == row && Grid.GetColumn(e) == column);
chart.Measure(new System.Windows.Size(470, 280));
chart.Arrange(new Rect(0, 0, 470, 280));
ExportCHARTtoBMP(chart,"chart"+row+""+column);
}
export to bmp func:
private void ExportGRIDtoBMP(Grid gridinput, string filename)
{
gridinput.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity));
int grid1Width = (int)Math.Round(gridinput.ActualWidth);
int grid1Height = (int)Math.Round(gridinput.ActualHeight);
grid1Width = grid1Width == 0 ? 1 : grid1Width;
grid1Height = grid1Height == 0 ? 1 : grid1Height;
RenderTargetBitmap rtbmp = new RenderTargetBitmap(grid1Width, grid1Height, 96d, 96d, PixelFormats.Default);
rtbmp.Render(gridinput);
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtbmp));
FileStream gridbmpfilestrm = File.Create(@"C:\Users\Admin\Desktop\" + filename + ".bmp");
encoder.Save(gridbmpfilestrm);
gridbmpfilestrm.Close();
rtbmp.Clear();
}
The problem is that when the image is saved to disk, the series of lines changes.
+3
source to share
No one has answered this question yet
Check out similar questions: