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.

Image

+3
c # image wpf


source to share


No one has answered this question yet

Check out similar questions:

1658
Get int value from enum in c #
1207
Strange memory issue when loading image into Bitmap object
781
When to use IMG versus CSS background?
774
Get property value from string using reflection in c #
636
How do I get the type T from a member of a generic class or method?
573
How do I get the size of an image (height and width) using JavaScript?
503
How to get color from hex color code using .NET?
374
Saving image from PHP url
319
Get url of image data in JavaScript?
251
Get / Select Image from Built-in Gallery App for Android



All Articles
Loading...
X
Show
Funny
Dev
Pics