Using Powershell and the System.windows.forms assembly i am trying to create a working webbrowser that looks like any other webbrowser so i can get a custom webbrowser in an application. The Primary Issue is loading the objects on the webpage such as images or just some Out of Support Pages This is what i got so far.
add-type -assemblyname 'system.windows.forms'
$Form=[system.windows.forms.form]::New()
$TextBox=[System.windows.forms.Combobox]::New()
$Browser=[system.windows.forms.WebBrowser]::New()
$Browser.Location = '0,25'
$TextBox.Add_KeyDown({if ($_.KeyCode -eq 'Return' -or $_.KeyCode -eq 'Enter'){$Browser.Navigate("$TextBox.Text")}})
$Form.StartPosition='CenterScreen'
$Browser.ScriptErrorsSuppressed=$True
$Form.Add_ClientSizeChanged({$Browser.Size="$($Form.ClientSize.Width*97),$($Form.ClientSize.Height-50)"})
$Form.Controls.add($TextBox)
$Form.Controls.Add($Browser)
$Form.ShowDialog()
I Suppressed the Script Errors to stop the annoying Popups.
I was Expecting This To Be Just Like Every Other WebBrowser Out there And it just does not look good or load alot of the WebPage stuff that every other webBrowser Does.
EnderTheOmega is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.