private static void PrepareTabControllerSupport(bool noTabber, ConnectionWindow connectionForm) { if (noTabber) connectionForm.TabController.Dispose(); else WindowList.Add(connectionForm); }
public static Form AddPanel(string title = "", bool noTabber = false) { try { var connectionForm = new ConnectionWindow(new DockContent()); BuildConnectionWindowContextMenu(connectionForm); SetConnectionWindowTitle(title, connectionForm); ShowConnectionWindow(connectionForm); PrepareTabControllerSupport(noTabber, connectionForm); return connectionForm; } catch (Exception ex) { MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t add panel" + Environment.NewLine + ex.Message); return null; } }
public static Image TakeScreenshot(ConnectionWindow sender) { try { var LeftStart = sender.TabController.SelectedTab.PointToScreen(new Point(sender.TabController.SelectedTab.Left)).X; //Me.Left + Splitter.SplitterDistance + 11 var TopStart = sender.TabController.SelectedTab.PointToScreen(new Point(sender.TabController.SelectedTab.Top)).Y; //Me.Top + Splitter.Top + TabController.Top + TabController.SelectedTab.Top * 2 - 3 var LeftWidth = sender.TabController.SelectedTab.Width; //Me.Width - (Splitter.SplitterDistance + 16) var TopHeight = sender.TabController.SelectedTab.Height; //Me.Height - (Splitter.Top + TabController.Top + TabController.SelectedTab.Top * 2 + 2) var currentFormSize = new Size(LeftWidth, TopHeight); var ScreenToBitmap = new Bitmap(LeftWidth, TopHeight); var gGraphics = Graphics.FromImage(ScreenToBitmap); gGraphics.CopyFromScreen(new Point(LeftStart, TopStart), new Point(0, 0), currentFormSize); return ScreenToBitmap; } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Taking Screenshot failed" + Environment.NewLine + ex.Message, true); } return null; }
private static void SetConnectionWindowTitle(string title, ConnectionWindow connectionForm) { if (title == "") title = Language.strNewPanel; connectionForm.SetFormText(title.Replace("&", "&&")); }
private static void ShowConnectionWindow(ConnectionWindow connectionForm) { connectionForm.Show(frmMain.Default.pnlDock, DockState.Document); }