Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Create a Select Resource Dialog Box
 

Create a Select Resource Dialog Box

Hi peeps, is it possible to create an instance of the Select Resource Dialog Box to use on a classes property?

I cant find it down as a normal editor and so i guess its hidden in Visual Studio.

The main reason I ask is because i have a custom editor class which displays a form, this form has another properties grid on it and one of the properties is a type image. At run time it works ok and when you try to change the image it brings up the default "open file" dialog, however - this form is for an editor and so used at design time within VS. Now when you try to edit the image a message box pops up saying the object is not refrenced as as instance of the object. I guess this has somthing to do with the service providers etc so id there another way i can use the Select Reources dialog box on that property to get it to work?
Cadey  Wednesday, September 16, 2009 12:00 PM

Hi Cadey,

According to my research, I know that the Resource Select Dialog is part of Visual Studio. Here is my test step.

1. Find a property that uses the Resource Select Dialog, e.g. The Image property of PictureBox control.

2. Use Reflector to view its source code. Below is its source code

[SRCategory("CatAppearance"), Localizable(true), Bindable(true), SRDescription("PictureBoxImageDescr")]

public Image Image

{

get

{

return this.image;

}

set

{

this.InstallNewImage(value, ImageInstallationType.DirectlySpecified);

}

}

There is no UITypeEditor declared at the header of the property.

3. Create a custom class called MyPictureBox. It inherited from System.Windows.Forms.PictureBox. Add a property called MyImage. Its type is also Image.

public class MyPictureBox : System.Windows.Forms.PictureBox

{

private Image myImage;

public Image MyImage

{

get { return myImage; }

set { myImage = value; }

}

}

4. When I edit the MyImage property of MyPictureBox in VS design. It shows Resource Select Dialog. But when I put a PropertyGrid control on the form and set its SelectedObject to MyPictureBox then run the application, you can see it popup Open File Dialog when trying to edit MyImage property.

Based on these test information, I think that Resource Selected Dialog is part of VS. Through I don’t find any document which can prove my analysis. But some words in the following document can indicate that.

http://msdn.microsoft.com/en-us/library/feh4ww6k.aspx

"The appropriate editor opens automatically when you create or open a resource."

"The Visual Studio resource editors do not support..."

If you have anything unclear, please feel free to tell me.

Sincerely,

Kira Qian

Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Thursday, September 17, 2009 10:15 AM
Hi Cadey,

I am writing to check the status of the issue on your side. Could you please let me know if the suggestion works for you? If you have any questions or concerns, please feel free to let me know. I will be more than happy to be of assistance.

Sincerely,
Kira Qian
Send us any feedback you have about the help from MSFT at EMAIL REMOVED
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Tuesday, October 06, 2009 9:02 AM

You can use google to search for other answers

Custom Search

More Threads

• MonthCalendar: HighLight Only Selected Range.
• Custom Combobox SmartTag
• Hiding Inherited Control's Properties
• How to draw border of a pop-up menu
• confussion into how to put progress bar into my project
• Change background image of MDI form
• User control doubt
• How to Hide Entire Category in a PropertyGrid
• BUG!!! Codedom compiler doesn't trigger an error
• Designtime mapping name problem