views:

56

answers:

1

Hi,

I'm using an OpenFileDialog in my Windows Form. I would like this dialog to be read only.

The only thing I would like is that the user can open/load a file. I would like to be able to disable all the "right mouse click" events (delete, rename etc.)

Is this possible? If not is there another component I can use?

Thanks!

A: 

It should be possible, but it probably won't be pretty. it might be better to write your own version of the OpenFileDialog where you can customize them as you want in a nice way.

However, if you want to do this, then you might be able to do all you want by getting hold of the Handle for the dialog after which you should be able to add your own event handlers etc as needed (to make it ignore right clicks etc).

Look at this CodeGuru article for details on getting the Handle: Customizing OpenFileDialog in .NET

This CodeProject article might also be useful: Extend OpenFileDialog and SaveFileDialog the easy way

ho1
Thanks I will look into this. I actually thought there would be an easier way.
PKK