예제 #1
0
        /// <summary>
        ///     Used to embed connections that don't derive from <see cref="ExternalConnection" />.
        /// </summary>
        /// <param name="ctrl"> The control to be embedded in the tab page. </param>
        protected void Embed(Control ctrl)
        {
            ctrl.InvokeIfNecessary(delegate
            {
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl);
            });

            if (this.TerminalTabPage != null)
                TerminalTabPage.InvokeIfNecessary(delegate { this.TerminalTabPage.Dock = DockStyle.Fill; ctrl.Parent = this.TerminalTabPage; });
        }
예제 #2
0
        /// <summary>
        ///     Used to embed connections that derive from <see cref="ExternalConnection" />.
        /// </summary>
        /// <param name="hWnd"> The control to be embedded in the tab page. </param>
        /// <param name="terminalTabPage">The terminal tab page that will be the parent of the external hWnd.</param>
        private Panel EmbedWindow(IntPtr hWnd, Control terminalTabPage)
        {
            lock (EmbedWindowLock)
            {
                terminalTabPage.InvokeIfNecessary(() => terminalTabPage.Controls.Clear());

                Panel panel = null;

                terminalTabPage.InvokeIfNecessary(() =>
                {
                    panel = new Panel
                    {
                        Size =
                            new Size(terminalTabPage.Size.Width,
                                    terminalTabPage.Size.Height)
                    };
                    panel.BringToFront();
                    SetParent(hWnd, panel.Handle);
                });

                SetWindowLong(hWnd, GWL_STYLE, WS_VISIBLE + WS_MAXIMIZE);
                MoveWindow(hWnd, 0, 0, terminalTabPage.Size.Width, terminalTabPage.Size.Height, true);

                terminalTabPage.InvokeIfNecessary(() => terminalTabPage.Controls.Add(panel));

                return panel;
            }
        }