By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

Windows style file browser

P: n/a
I've written a simple application which connects to an FTP server and
recursively lists the contents of the directories in this server in a
ListBox. What I'm wanting to do is change the ListBox and instead, use
something like the Windows file browser. Like when you go through My
Computer, that kind of thing.

Looking at the components that come with Windows.Forms I'm guessing my best
bet is the ListView. The problem I see with this component is, although you
can add pictures for the icons of the contents, they wont be the official
icons. I.E. When the user changes the icon theme these wont change because
they're static pictures.

Is it possible to use the official file browser in a C# app and if so how?
If not, what alternatives are there that I should look at?

Cheers,

Darrell

Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Redneon,

You may be able to use the embedded Internet Explorer control (the browser
control contained within shdocvw.dll) and leverage its built-in file system
browsing capabilities to accomplish what you need.

Check out this article for a good tutorial on how to do this...

Let me know if it works....

Cheers,

Wadih Pazos

Solutions@MBA

wp****@satmba.com

www.SatMBA.com

www.PaperSave.com

"redneon" <re*****@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com...
I've written a simple application which connects to an FTP server and
recursively lists the contents of the directories in this server in a
ListBox. What I'm wanting to do is change the ListBox and instead, use
something like the Windows file browser. Like when you go through My
Computer, that kind of thing.

Looking at the components that come with Windows.Forms I'm guessing my
best
bet is the ListView. The problem I see with this component is, although
you
can add pictures for the icons of the contents, they wont be the official
icons. I.E. When the user changes the icon theme these wont change because
they're static pictures.

Is it possible to use the official file browser in a C# app and if so how?
If not, what alternatives are there that I should look at?

Cheers,

Darrell

Nov 16 '05 #2

P: n/a
Darrell,

Even if you were able to access a file browser component, it would
probably link directly to the filesystem, and not allow you to specify which
items you want to display.

The ListView is still the way to go, IMO, you just have to get the icons
for the files. You can get the operating system icons. You can call the
SHGetFileInfo function through the P/Invoke layer to get the icon for
directories and files (either specific ones or for general ones). This way,
you don't have to worry about changes to the icons changing your icons.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"redneon" <re*****@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com...
I've written a simple application which connects to an FTP server and
recursively lists the contents of the directories in this server in a
ListBox. What I'm wanting to do is change the ListBox and instead, use
something like the Windows file browser. Like when you go through My
Computer, that kind of thing.

Looking at the components that come with Windows.Forms I'm guessing my
best
bet is the ListView. The problem I see with this component is, although
you
can add pictures for the icons of the contents, they wont be the official
icons. I.E. When the user changes the icon theme these wont change because
they're static pictures.

Is it possible to use the official file browser in a C# app and if so how?
If not, what alternatives are there that I should look at?

Cheers,

Darrell

Nov 16 '05 #3

P: n/a
Thanks. I decided to go the SHGetFileInfo router because using IE wouldn't
allow me to specify what's shown. I'd have a lot more control, plus MS
recommend it. I've been looking at the followin MSDN article on it...

http://support.microsoft.com/?kbid=319350

....which has taught me what I needed to know. But I have a little problem
with it. It doesn't seem to work with transparencies well. Instead, it seems
to just show what should be transparent as black. Look at the following for a
screenshot...

http://www.attw91.dsl.pipex.com/capture.jpg

Any ideas of a way around this because it looks really ugly?

Darrell

Nov 16 '05 #4

P: n/a
Darrell,

I think that the reason that is happening is because you are using the
new icon formats that were introduced with XP. They have a larger color
palette, and I don't think that the ListView (or the painting algorithms)
support it as of yet. You will have to use the icons with the lower color
palette, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"redneon" <re*****@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
Thanks. I decided to go the SHGetFileInfo router because using IE wouldn't
allow me to specify what's shown. I'd have a lot more control, plus MS
recommend it. I've been looking at the followin MSDN article on it...

http://support.microsoft.com/?kbid=319350

...which has taught me what I needed to know. But I have a little problem
with it. It doesn't seem to work with transparencies well. Instead, it
seems
to just show what should be transparent as black. Look at the following
for a
screenshot...

http://www.attw91.dsl.pipex.com/capture.jpg

Any ideas of a way around this because it looks really ugly?

Darrell

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.