1

I am searching for a way to make this: alt text

As you see, my aim is to build something in explorer UI. Also, it looks very like like the Control Panel stuff.

I would like to get code example how to do this C# (which is my "primary" language), C++ or any other programming language.

Thank you.

P.S: It there are any differences between making this in Windows XP, Windows Vista and Windows Seven, please say them.

Edit: The application will be somehow (that's the question) into windows explorer. How application will be runned (actually "viewed")? User will open Windows Explorer, type "My Application" into address bar, press enter and he will see something like above.

Thank you.

Edit: Eh... I just came in this website in MSDN http://msdn.microsoft.com/en-us/library/bb757044.aspx. I gues that the only simple way to accomplish my idea is to make control panel applet.


Maybe anybody knows, how to map Control Panel paths. For example user goes to "My Application", but gets redirected to "Control Panel\My Application"?

Thank you.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
ernestasju
  • 1,319
  • 1
  • 11
  • 14

3 Answers3

1

I'm not entirely sure what the question here is because you don't mention what exactly the problems are that you've encountered in trying to design the interface that you want.

(EDIT: I'm assuming WinForms here because the original question doesn't specify. If you're using WPF, you may find that some things are even simpler, but a lot of the same links will still apply.)

Honestly, most of this looks extremely simple to replicate in the Visual Studio Designer. The Labels, LinkLabels, and Buttons that you indicate with arrows in the screen shot are all available in WinForms applications, and they'll look just like that. To ensure that they replicate the Windows native look and feel exactly, set the FlatStyle to "System" on any controls where that property is exposed.

The background of the form is just plain-old white instead of the 3D control color (oh, how UI design goes in circles). You can achieve the same by setting the BackColor property of your form to "White".

That leaves us with re-implementing the Explorer-style toolbar, which it seems to me might better approach your actual question. The first thing you notice is the Aero glass effect in the toolbar. There have been numerous questions asked here about how to get Aero glass effects in WinForms applications, and just as many more blog posts, code samples, and more posted across the Internet. You just need to extend the glass effect from the borders of your window into the client area. Of course, support for this has not been built into the .NET Framework and you're going to have to P/Invoke the Desktop Window Manager (DWM) API that is present in Windows Vista and later in order to achieve this effect, which can get complicated quickly. These links should help get you started:

Once you've done that, all that's left is adding a few controls to the top region of the client area that you've now rendered as glass. The screen shot above has two back/forward buttons and two textboxes. Those should all be relatively simple to recreate. The back/foward button icons are standard images included in the Windows shell libraries—have a look at the answers to this question for some ideas on how to retrieve them. The path textbox doesn't look like anything special to me, so unless you're seeking its custom behavior (breadcrumb navigation, etc.), you can just use the standard WinForms TextBox control. For the search textbox, a quick Google search turned up a link to this article on how one might re-implement it in WinForms, which looks very promising.

I realize this may seem like a lot, but the best thing to do is just dive into it, employing standard controls where they will do what you want and creating custom controls that derive from those standard controls where you find the need for a little something extra. If/when you run into specific problems, feel free to ask a more specific question where we can provide better insight. Good luck!


Postscript: As far as I know, most of this will look and work the same way on Windows Vista and Windows 7. Windows XP does not support the Desktop Window Manager, and therefore does not have the Aero user interface. Windows Explorer looks very different in Windows XP. If you're trying to re-create the look of Windows Vista+ on Windows XP, you really do have your work cut out for you. You're going to have to detect which operating system your user is running and if it's lower than Vista, revert to custom-drawing all of your own window chrome where Aero glass would be used in later versions of Windows.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • But even XP have Control Panel. I really do not care about Desktop Window Manager as my application should be integrated just like Control Panel. – ernestasju Nov 12 '10 at 11:09
  • Eg. You open My Computer, type My Application into adress bar, press enter and you see my application. – ernestasju Nov 12 '10 at 11:10
  • 1
    Uhhh, boy, I think we all *completely* misunderstood. You should probably have provided an example like that in the original question. So, you want your application to literally open in Windows Explorer? I'm fairly certain that's impossible, and I'm very certain that it's not worth the effort. I've never seen another application do this and bizarre, non-standard behavior like this is sure to confuse your users. I also have a feeling that hooking Windows Explorer like that is prohibited by the Windows SDK, and if it's not, it probably should be. – Cody Gray - on strike Nov 12 '10 at 11:30
  • 1
    Otherwise, perhaps you're looking to create a shell namespace extension? See this article on MSDN: http://msdn.microsoft.com/en-us/library/cc144095(v=VS.85).aspx, or possibly this sample project: http://www.codeproject.com/KB/tree/enumdeskclones.aspx – Cody Gray - on strike Nov 12 '10 at 11:31
0

Why do you need this? In Visual Studio you can add an explorer-like window to your project.

Other than that, you'd have to put controls together, build your own, and develop a lot of classes (DON'T make it all in one class ok? I.E., study OOP, get a book if you need).

Cheers :)

Camilo Martin
  • 37,236
  • 20
  • 111
  • 154
  • Erm... I know about OOP and I made dozens of Windows Forms applications already. – ernestasju Nov 12 '10 at 11:05
  • I want to know how to make my application not just look like Control Panel stuff, actualy be like it. – ernestasju Nov 12 '10 at 11:07
  • You are basically asking "I want that!" ...but you're not telling us **what** part of *that* is the one you want. If you want to make something just like control panel, what's stopping you? Is there one particular feature you're having problems to implement? – Camilo Martin Nov 12 '10 at 23:28
0

tutorial on creating a custom Windows Forms control from Start to Toolbox

You can find more such samples in code project

Andrew Collins
  • 2,541
  • 3
  • 17
  • 16