private void InitPage() { page = new System.Windows.Forms.WebBrowser(); page.Dock = System.Windows.Forms.DockStyle.Fill; page.Location = new System.Drawing.Point(0, 0); page.MinimumSize = new System.Drawing.Size(20, 20); page.Name = "webBrowser"; page.Size = new System.Drawing.Size(150, 150); agent.Controls.Add(page); // WFHost.Child = agent; page.BringToFront(); page.Visible = false; page.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.onPageLoad); }
//START OF VIDEO CALLING CODE public void addCaller(UserControl uc) { this.uc = uc; page = new System.Windows.Forms.WebBrowser(); page.Dock = System.Windows.Forms.DockStyle.Fill; page.Location = new System.Drawing.Point(0, 0); page.Name = "videoCaller"; this.uc.Controls.Add(page); page.BringToFront(); page.Visible = false; page.ScriptErrorsSuppressed = true; page.Navigate("https://ragserver.ccs.neu.edu/hangoutTest/"); page.ObjectForScripting = this; page.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.onVideoCallerDocumentComplete); }
public void Render() { if (browser == null) { return; } if (widget.GloballyVisible) { FitBrowserInWidget(); browser.Show(); browser.BringToFront(); } else { browser.Hide(); } }
internal static Image ExtractSnapshot(WebBrowser browser) { browser.ClientSize = new Size(850, 1500); Rectangle bounds = browser.Document.Body.ScrollRectangle; IHTMLElement2 body = browser.Document.Body.DomElement as IHTMLElement2; IHTMLElement2 doc = (browser.Document.DomDocument as IHTMLDocument3).documentElement as IHTMLElement2; int scrollHeight = Math.Max(body.scrollHeight, bounds.Height); int scrollWidth = Math.Max(body.scrollWidth, bounds.Width); scrollHeight = Math.Max(body.scrollHeight, scrollHeight); scrollWidth = Math.Max(doc.scrollWidth, scrollWidth); Rectangle finalBounds = new Rectangle(0, 0, scrollWidth, scrollHeight); browser.ClientSize = finalBounds.Size; var bitmap = new Bitmap(scrollWidth, scrollHeight); browser.BringToFront(); browser.DrawToBitmap(bitmap, finalBounds); return bitmap; }
public WebBrowser(TPlayer player, PlayerItem playerItem) : this(player) { this.Text = label1.Text = playerItem.name; try { webPlay.Navigate(playerItem.url); } catch { webPlay = new System.Windows.Forms.WebBrowser { Dock = DockStyle.Fill, Name = "webPlay", //ScriptErrorsSuppressed = true, TabIndex = 0 }; this.Controls.Add(webPlay); webPlay.BringToFront(); webPlay.DocumentCompleted += webPlay_DocumentCompleted; webPlay.Navigate(playerItem.url); } pictureBox2.Visible = true; pictureBox2.Start(); }
private void button_source_Click(object sender, EventArgs e) { wb = new WebBrowser(); wb.Size = new Size(findControl("console_panel").Size.Width, Size.Height - sizeManager_console.Location.Y); wb.Location = sizeManager_console.Location; wb.Name = "wb"; Controls.Add(wb); modVisible(new Control[] { getTBox("console"), getTBox("editor"), findControl("console_panel"), findControl("editor_panel") }, false); wb.Show(); wb.BringToFront(); wb.Url = new Uri("https://github.com/lyokofirelyte/PseudoCompiler"); modVisible(new Control[] { button_refresh, panel_refresh, button_run_code, panel_run_code, button_open_new_file, panel_open_new_file, panel_stop_code, button_stop_code }, false); modVisible(new Control[] { panel_save, button_save }, false); }
void UpdateView() { CodeFormat format = CodeFormat.Disassemble; if (radioCFDecompile.Checked) { format = CodeFormat.ScruffDecompile; } else if (radioFullDecompile.Checked) { format = CodeFormat.FullDecompile; } string code = _scriptFile.GetCode(format); if (_browser != null) { Controls.Remove(_browser); } _browser = new WebBrowser(); _browser.Dock = DockStyle.Fill; _browser.AllowNavigation = false; _browser.AllowWebBrowserDrop = false; //_browser.WebBrowserShortcutsEnabled = false; _browser.IsWebBrowserContextMenuEnabled = false; if (radioFullDecompile.Checked & code.Length < 0x10000) { var codeFormat = new ScruffFormat(); string text = codeFormat.FormatCode(new MemoryStream(Encoding.ASCII.GetBytes(code))); text = "<style>" + ".csharpcode, .csharpcode pre" + "{" + " font-size: 10pt;" + " color: black;" + " font-family: Consolas, Courier New, Courier, Monospace;" + " background-color: #ffffff;" + "}" + ".csharpcode pre { margin: 0em; }" + ".csharpcode .rem { color: #008000; }" + ".csharpcode .kwrd { color: #0000ff; }" + ".csharpcode .str { color: #006080; }" + ".csharpcode .op { color: #0000c0; }" + ".csharpcode .preproc { color: #cc6633; }" + ".csharpcode .asp { background-color: #ffff00; }" + ".csharpcode .html { color: #800000; }" + ".csharpcode .attr { color: #ff0000; }" + ".csharpcode .alt " + "{" + " background-color: #f4f4f4;" + " width: 100%;" + " margin: 0em;" + "}" + ".csharpcode .lnum { color: #606060; }" + "</style>" + text; _browser.DocumentText = text; } else { string text = "<pre>" + code.Replace("\n", "<br/>") + "</pre>"; _browser.DocumentText = text; } Controls.Add(_browser); _browser.BringToFront(); }
private void GenerateThumbnailFromCompletedPage(WebBrowser m_WebBrowser) { m_WebBrowser.ClientSize = new Size(this.m_BrowserWidth, this.m_BrowserHeight); m_WebBrowser.ScrollBarsEnabled = false; m_Bitmap = new Bitmap(m_WebBrowser.Bounds.Width, m_WebBrowser.Bounds.Height); m_WebBrowser.BringToFront(); m_WebBrowser.DrawToBitmap(m_Bitmap, m_WebBrowser.Bounds); m_Bitmap = (Bitmap) m_Bitmap.GetThumbnailImage(m_ThumbnailWidth, m_ThumbnailHeight, null, IntPtr.Zero); }
public void ShowInfoPage() { this.SuspendLayout(); WebBrowser webStart = new WebBrowser(); PNLlist.Controls.Add(webStart); webStart.Visible = false; webStart.ScriptErrorsSuppressed = true; webStart.ScrollBarsEnabled = false; webStart.Dock = DockStyle.Fill; webStart.BringToFront(); Button btnClose = new Button(); this.Controls.Add(btnClose); btnClose.Visible = false; btnClose.Size = new Size(PNLlist.Width - 6, 35); btnClose.Location = new Point(15, PNLlist.Height - 39 + 39); btnClose.FlatAppearance.BorderColor = Color.Gray; btnClose.BackColor = Color.FromArgb(64, 64, 64); btnClose.ForeColor = Color.WhiteSmoke; btnClose.Text = "Close"; btnClose.FlatStyle = FlatStyle.Flat; btnClose.BringToFront(); this.ResumeLayout(); btnClose.Click += (e, s) => { PNLlist.Controls.Remove(webStart); this.Controls.Remove(btnClose); }; webStart.Navigated += (e, s) => { if (!webStart.Document.ToString().ToLower().Contains("checking your")) { webStart.Show(); btnClose.Show(); } }; webStart.Navigate("http://www.realmbot.xyz/hello.html"); }
private void ShowEmbeddedBrowser(WebBrowser embeddedBrowser) { embeddedBrowser.Dock = DockStyle.Fill; embeddedBrowser.IsWebBrowserContextMenuEnabled = false; embeddedBrowser.Parent = this; embeddedBrowser.Visible = true; embeddedBrowser.BringToFront(); advancedAreaContainer.Visible = false; }