/// <summary> /// To load the Image stored in the given filepath /// </summary> /// <param name="filePath"></param> private void LoadImage(string filePath) { //1) create an instance of type dataTable and store the images in it. DataTable imageTable = resultDataSet.Tables["GraphsImages"]; // 2) insert the desired number of rows in the table that holds the images. DataRow newRow = imageTable.NewRow(); // 3) get the image file into a stream reader. FileStream fs = new FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] Image = new byte[fs.Length]; fs.Read(Image, 0, Convert.ToInt32(fs.Length)); fs.Close(); newRow[0] = filePath; newRow[1] = Image; imageTable.Rows.Add(imageTable); }
/// <summary> /// Handles the Click event of the btnGenerateReport control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void btnGenerateReport_Click(object sender, RoutedEventArgs e) { string filePath = @"c:\temp\interaction.bmp"; InteractionChart.SaveBitmap(filePath); //VolumeChart.SaveBitmap(@"c:\temp\volumechart.bmp"); //NetTorqueChart.SaveBitmap(@"c:\temp\netTorqueChart.bmp"); //NetWOBChart.SaveBitmap(@"c:\temp\netWOBChart.bmp"); //AreaChart.SaveBitmap(@"c:\temp\areaChart.bmp"); //DPCChart.SaveBitmap(@"c:\temp\DPCChart.bmp"); //ForceChart.SaveBitmap(@"c:\temp\forcechart.bmp"); //WearRateChart.SaveBitmap(@"c:\temp\wearRateChart.bmp"); LoadImage(filePath); ReportGenerated(this); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)