I want to save an image of the chart where a strategy is activated, but in a chart with several tabs, with this method it sends me the active tab, is it possible to send the chart where the active strategy is and not the tab that is visible?
public static class ScreenShot
{
public static void SaveChart(ChartControl cc)
{
try
{
cc.Dispatcher.InvokeAsync(()=>{
Chart chart = Window.GetWindow(cc) as Chart;
RenderTargetBitmap screenCapture = chart.GetScreenshot(ShareScreenshotType.Chart);
System.Windows.Media.Imaging.BitmapFrame outputFrame = BitmapFrame.Create(screenCapture);
if (screenCapture != null)
{
try
{
PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(outputFrame);
using (Stream stream = File.Create(string.Format(@"{0}\{1}", Core.Globals.UserDataDir, "TelegramImage.png"))) png.Save(stream);
}
catch (IOException)
{
NinjaTrader.Code.Output.Process("ScreenshotTakerEx ample: Could not take screenshot", PrintTo.OutputTab1);
}
}
});
}
catch (Exception ex)
{
NinjaTrader.Code.Output.Process("Could not save screenshot " + ex, PrintTo.OutputTab1);
}
}
}
Comment