WebBrowsing with different browsers in C# - c#

I need to build a small application to compare site rendering in different browsers in different resolutions.
First I need to support IE, FF, Chrome and user will choose to preview her site in different resolutions.
WebBrowser control do not offer me this.
Can you tell me is there any control or library to solve this problem in C#, .Net?
Thanks in advance!

Stack Overflow itself provided some options.
I'd say you can put each one of the following into a TabControl, so the user can easily choose and switch view.
For Internet Explorer, stock WebBrowser control should do.
Firefox Wrapper (GeckoFX)
Chrome wrapper (Webkit.NET)

Related

how can i use IE (or different browser) for each webbrowser controle?

i want to use different browsers for my webbrowser controls in c#.NET.
for example, if im log into facebook from the webbrowser1, i will not in the webbrowser2
if i cant use ie different for each webbrowser... can i separate cookies for each webbrowser control?
for example, if i navigate using the first controle
webbrowser1.navigate("this is not important");
then submit the login form
webbrowser1.document.getelem..... click
thats will not applicated on the secod control( webbrowser2)
-
i hope you inderstand what i want :)
The WebBrowser control is a wrapper around IE and will always and only use IE. It's never going to use Firefox or Chrome etc. Some browsers apart from IE may allow Automation, but you'll have to check their documentation.
In your two lines of code, both are using the control called webbrowser1, so the Navigate and getelement will always go to the control. If you want to use two browser instances, you need to have 2 controls.
I don't clearly understand what your question is. The two points above are what I can answer.

high DPI pages not displayed correctly in web browser control

I have been researching on this for a while and can't seem to make any headway.
I am developing an Outlook shared add-in (in C# on .Net 4.0) that loads a web page within a web browser control on user request. I have tried using both the Windows.Forms.WebBrowser control and the AxSHDocVw.AxWebBrowser control. The web page I am loading has many html controls inclusive (but not limited to) of basic html/asp.net textbox and labels to Telerik buttons and redSelect controls.
The problem I am having is that when the user has a high DPI setting, the web page's controls are not re-sized correctly. That is, the labels and textBoxes are re-sized correctly, but other controls - mostly the Telerik ones - are not re-sized (or is it that they are scaled back??). However, if I open the same web page in IE, FF, Chrome or any other browser while in high DPI, all controls are scaled correctly.
I have tried setting the "FEATURE_BROWSER_EMULATION" registry key for outlook.exe as well, to no avail. As my application is an outlook shared add-in, I do not have a manifest to set the dpiAware setting.
Has anyone come across such an issue? Any help will be greatly appreciated. Thanks!
--EDIT--
On further testing I found that the issue is that Outlook is already declared as dpiAware. It is because of this that the Telerik controls do not get scaled. Is there a way that I can instruct the web browser control to display as dpi un-aware? Or is there a better way to solve this?
Check next post You may experience resource limitations in the Graphics Device Interface (GDI) when you use the Microsoft Web Browser control. That post is related to the WinXP or Server 2003 computer that is running Microsoft Office XP or Microsoft Office 2003.
One more to look is FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI
Internet Explorer 9. By default, the WebBrowser Control uses Microsoft DirectX to render webpages, which might cause problems for applications that use the Draw method to create bitmaps from certain webpages.

.NET API for launching Internet Explorer with certain size and position?

I would like to create a windows desktop-looking app (Windows 7 and 8) out of my online html-app. I have tried embedding a browser-control in a WPF-window but then noticed it was an old version (IE7) of IE running inside WPF. I'm not sure if IE9 or IE10 will ever work embedded inside a WPF-app but I guess not. And I need the latest version of IE.
I've looked into the command line switches for IE but that didn't seem to do much with the visual presentation of the windows, except "kiosk mode". What I want is to at least set size and position, turn off all bars (except perhaps the address bar).
I've also looked into HTA-apps but I can't get it to open the external url in the same window. It keeps opening a new ordinary IE-window.
Any more options I haven't tried? Perhaps I can use some .NET API for this? I have searched but found very little information about any API for this (Only Process.Start which isn't enough)
What you may be looking for is called Kiosk Mode, which hides the browser UI and gives you a full-screen page only.
It sounds like you need to split things up: you're going to need to detach yourself from how your user interface works. You might need to re-engineer some parts of your application, but in the end you'll be way closer to your goal with two distinct UIs, in a branched structure like this (poor ASCII art schema below):
(Application core)
| |
Web UI ---+ +--- WPF UI
Different UIs have different capabilities, and you may find that leveraging each one provides benefits.
I've solved this myself now:
It turnes out the WebControl in WPF supports IE9 after all. It just depends on the content I'm loading in it. The source html has to be of the correct format for it to be loaded with IE9 (as opposed to IE7 which seem to be default).
Found it out here.

Get value of Label in ASP.NET website from C# windows form application

I am developing web browser in C# windows form application using WebBrowser component.And also a website in ASP.NET using C#.Both are different projects.How can i use value of Label from windows form application and use the same value in ASP.NET website?
Help me !
Thanks in advance !!
Did you know you can write code to automate browsers, such as IE or Firefox? I mean, write code to launch a browser window, load pages at will, easily access particular parts of web pages, simulate user input (textboxes, controls, buttons, etc). It's commonly used to automate testing of web pages, and what-not.
There are multiple libraries out there, but I personally tried WatIn: http://watin.org/. Open source (free), .net component, easy to use, ton of examples.
I'm suggesting this as an alternative - if it fits your model. I know this doesn't answer your question; sorry.

Windows Forms Browser Skeleton (C#/.NET)

I was wondering if anyone knows of an existing sample or an approach to achieve the desired functionality.
Basically, what I'm looking for is a web browser like skeleton. The idea is that the main screen of my application is shown in the left tab. This tab can never be closed. On this screen is an overview of various application components such as activities, events, contacts, etc.
When the user clicks on a specific contact/event/activity a new tab is created and auto-focused. The user can view and edit the information. When they are done they can close the tab.
The ability to have multiple tabs open is important.
Also, keyboard shortcuts to easily navigate between tabs would be great, but not absolutely essential at this point.
Note: I don't need to access any web content.
Really what I'm looking for, at least what I think I'm looking for, is a shell of a modern web browser. Does something like this exist? Is there a good approach to building such an application?
Note: I'm new to Windows GUI development, so I apologize if this is a rudimentary question. I was unable to find anything meaningful while searching MSDN and other resources.
Thanks!
What it sounds like is not really a Web Browser shell at all, simply the relative appearance of one functionality-wise.
What you can do is use a TabControl control. This can be altered to suit your needs quite perfectly in my view.
An example of a modified TabControl is as follows: [ From here ]
There are a number of things that can be done with a TabControl (as with any other component) to make it suit what you need.
Here are some links that you may find helpful:
Flat Tab Control - As per the picture
MSDN
Video on using a Tab Control
C# Corner

Categories

Resources