private void takeScreenShotBtn_Click(object sender, EventArgs e) { if (tabControl.SelectedIndex < 0) { return; } var selTab = tabControl.SelectedIndex; if (pluginMain.Overlays.Count < 1) { return; } IOverlay selectedOverlay = pluginMain.Overlays[selTab]; try { selectedOverlay.TakeScreenShot( new ScreenshotConfig { SavePath = config.ScreenShotSavePath, AutoClipping = config.ScreenShotAutoClipping, BackgroundImagePath = config.ScreenShotBackgroundPath, BackgroundMode = (ScreenshotBackgroundMode)config.ScreenShotBackgroundMode, Margin = config.ScreenShotMargin, }); } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().ToString()); } }