===================================================
(Improved question)
This is improved question, please first see the 'original question', and then the following text in 'Answer1', thanks OriginalGriff provide the suggestion to try the following lines :
foreach (Control c in propertyGrid1.Controls)
{ c.MouseClick += new MouseEventHandler
(MyMouseClickEventHandlerWhatEverItIsCalledInYourCode)
};
But when I do verification, it shows can not generate "propertyGrid1.Controls" ! However, I see there are events of ControlAdded and ControlRemoved can be selected, why it can not have "propertyGrid1.Controls" !? Can any one helps to show the root cause ?
====================================================
(Original question)
I write a Window form application, and place a PropertyGrid on form, and in PropertyGrid atrribute table :
1. I assign object to the SelectedObject attribute.
1. Enable the 'MouseClick' event on.
2. Write one line 'int i=0' in the 'MouseClick' event (for debug only).
3. Run it, and it works fine.
However, when I click the PropertyGrid, the 'MouseClick' event will not be invoked !
But, when I change the event setting to be 'SelectedGridItemChanged', and click differnt
grititem on PropertyGid, it then can invoke the 'SelectedGridItemChanged' event !
Question :
1. How can I let the 'MouseClick' event be invoked ?
My purpose is to detect if any griditem is clicked, and then check if the griditem is
the one I would like to do advanced process.
2. Actually, I would like for user to edit some griditems, which has string array of text.
I've searched some articles in CodePage, which have mentioned about the way to reach
it, but all seems be so complicated, I surpose there should have simple way to reach
my request, can any one show the simple and detailed sample to me for reference ?
note :
1. The 'SelectedGridItemChanged' event can not meet my request, since I would not do the
dedicated advanced process when item is just changed, and, I would do it when user
right click mouse (to edit the text of the clicked griditem)
2. The system has built-in function of text viewing for griditem, such as when moving
mouse on the value row of griditem which has type of string array, the system will
automatically show the whole text window for user to view. But, I surpose it's not
enough for user to do editing, so I request to let user to click the griditem, and
then can show a muliple line textbox for user to edit.