I' trying to use webbrowser to create a folder explorer and I have few problems that I could not find any answer on the web... so I’ll appreciate your answers:
Can someone please explain how can I create the Up button (going to parent folder)?
How can I the explorer bar (on the left) to favorites or search as in windows explorer?
How can I implement the undo functionality (undelete files and folders)
What I would do intercept calls to a url and inject the data from your application. That way you can write HTML and display whatever functionality you want.
This Code Project WebBrowser Control might be useful too. I wouldn't be surprised if it allows you to handle the button click events on the navigation bar.
Related
I have an Internet Explorer window open. The title of this window will always be "test123"
how do I save the source of the contents of the window as an HTML file?
Please note that the process should not be to open a URL and read the HTML into a variable. I absolutely HAVE TO do it the way I described since I need to login to a site to be able to view the HTML that I want to save.
**if it makes it easier to do this through my winform and putting a webbrowser control on it, that is fine as well.
You can attach to virtually any Windows app, using managed code and the UI Automation classes. Not a lot of people know about this stuff.
Microsoft shipped a class library and runtime that allows applications to automate other Windows on the system. You can do things like click buttons, read textboxes, activate menus, and so on. Here's a quick intro.
It should be relatively simple to attach to an IE Window, and then programmatically tickle the File...Save As... menu option.
I did this the other day for a Paint.NET app. It took much less time that I thought it would.
But I agree it's probably easier to use a WebBrowser control in a regular app, to programmatically retrieve content. You could also use the System.Net.WebClient class to do it, if you don't need to show the HTML content.
If you embed a WebBrowser control inside of your WinForm you can do this:
webBrowser1.Navigate("http://StackOverflow.com");
string pageHtml = webBrowser1.Document.GetElementsByTagName("html")[0].InnerHtml;
This will return all of the HTML in the page navigated to.
I would like to add a control to my app where the user can browse his local file system and select a directory. I would prefer to host this control on my main app window, and not do this via a pop-up dialog.
There isn't one built in.
You can either use the WinForms file/folder browser, search Code Project or similar site for someone else's implementation or write your own.
I've found one on Ookii Dialogs that includes some other standard dialogs.
If you want to host the controls on your own form, use controls from Shell MegaPack.WPF
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
Using C# and WinForms in VS2008, I want to create a file browser control that looks and acts like the left pane in Windows Explorer. To my astonishment, such a control does not ship with .NET by default.
Ideally, I would like its contents to be exactly the same as in Explorer. For example, on Windows 7, it should show the Favorites and Libraries pseudo-folders. Of course, I do not want to code specifically for each version of Windows if I can help it.
I have browsed around, and there are some examples of such controls, but they are all hand-rolled and therefore won't work 100% the same as the one in Explorer.
Is there any way I can simply reuse the Explorer control instead? Or, if not, to get access to a tree of the items that it would show?
Microsoft provides a walkthrough for creating a Windows Explorer style interface in C#.
There are also several examples on Code Project and other sites. Immediate examples are Explorer Tree, My Explorer, File Browser and Advanced File Explorer but there are others. Explorer Tree seems to look the best from the brief glance I took.
I used the search term windows explorer tree view C# in Google to find these links.
It's not as easy as it seems to implement a control like that. Explorer works with shell items, not filesystem items (ex: the control panel, the printers folder, and so on). If you need to implement it i suggest to have a look at the Windows shell functions at http://msdn.microsoft.com/en-us/library/bb776426(VS.85).aspx.
Take a look at Shell MegaPack control set. It provides Windows Explorer like folder/file browsing with most of the features and functionality like context menus, renaming, drag-drop, icons, overlay icons, thumbnails, etc
What is the best way to display Flash content in a C# WinForms application? I would like to create a user control (similar to the current PictureBox) that will be able to display images and flash content.
It would be great to be able to load the flash content from a stream of sorts rather than a file on disk.
While I haven't used a flash object inside a windows form application myself, I do know that it's possible.
In Visual studio on your toolbox, choose to add a new component.
Then in the new window that appears choose the "COM Components" tab to get a list in which you can find the "Shockwave Flash Object"
Once added to the toolbox, simply use the control as you would use any other "standard" control from visual studio.
three simple commands are available to interact with the control:
AxShockwaveFlash1.Stop()
AxShockwaveFlash1.Movie = FilePath &
"\FileName.swf"
AxShockwaveFlash1.Play()
which, I think, are all self explanatory.
It would be great to be able to load
the flash content from a stream of
sorts rather than a file on disk.
I just saw you are also looking for a means to load the content from a stream,
and because I'm not really sure that is possible with the shockwave flash object I will give you another option (two actually).
the first is the one I would advise you to use only when necessary, as it uses the full blown "webbrowser component" (also available as an extra toolbox item), which is like trying to shoot a fly with a bazooka.
of course it will work, as the control will act as a real browser window (actually the internet explorer browser), but its not really meant to be used in the way you need it.
the second option is to use something I just discovered while looking for more information about playing flash content inside a windows form. F-IN-BOX is a commercial solution that will also play content from a given website URL. (The link provided will direct you to the .NET code you have to use).
Sven, you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The F-IN-BOX, although just a wrapper of the Shockwave Flash Object seems to provide much more functionality, which may just help me!
Shooting flys with bazookas may be fun, but an embeded web brower is not the path that I am looking for. :)
There was a link on Adobe's site that talked about "Embedding and Communicating with the Macromedia Flash Player in C# Windows Applications" but they seem to have removed it :(