views:

33

answers:

2

This is a general question, but I'll explain my specific need at the moment:

I want to find the framework class that enables one to choose an image at design-time. I can find the editor that is used at run-time - its the Drawing.Design.ImageEditor. At design time, however, a different editor pops up which allows one to choose an image from resources.

I'm guessing I could run some kind of program, then open up the image editor, from the property grid, and see what new windows/classes have been created?

Thanks

+1  A: 

A tool with similar functionality to what you mention is Spy++ which you can find in your Visual Studio folder on the start menu (under the sub menu Visual Studio Tools).

However, if I understand you correctly, I don't think the design time editor you're talking about is written in managed code and even if it was, I'm fairly sure it's not in the framework. It's just part of Visual Studio itself and as far as I know you can't get hold of the source code for that.

ho1
Thanks, I don't appear to have that but I've heard of it. I'll do a google and try it out.
Jules
+1  A: 

Yes, you can see what's being used by using another instance of Visual Studio and use Tools + Attach to Process (managed) to look at the call stack. It is a Microsoft.VisualStudio.Windows.Forms.ResourcePickerDialog. That is not something you can use in your own code, the Visual Studio designer assemblies are not re-distributable. Nor would they be useful, they monkey with the design-time state of the project.

Making you own isn't that hard, just use Reflection to iterate the properties of Properties.Resources and find the ones that have the Bitmap or Icon type. Display them in a ListView to allow the user to pick one. Adding resources at runtime isn't an option.

Hans Passant
Not an option for me, I'm on the express edition. Thanks for finding the dialog though. I don't want to create my own, I need to have a look at the services it's using because I'm getting a null reference exception when I try and browse for an image, at design time, from a property grid - not the V Studio property browser. My next question is how the hell do I add these services! I'll create a new question for that.
Jules
In case anyone is interested, I've answered the question here: http://stackoverflow.com/questions/2632728/how-to-add-a-service-to-the-type-descriptor-context-of-a-property-grid-in-net
Jules