Hi Mats Uppstrom,
The reason why PropertyGrid cannot receive Mouse event is that PropertyGrid contains some child controls which prevent the PropertyGrid receive Mouse event. You can loop through all child controls and register Mouse event for these controls. Check the following code:
Code Block
PropertyGridP
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void Form5_Load(object sender, EventArgs e)
{
foreach (Control c in this.propertyGrid1.Controls)
{
c.MouseClick += new MouseEventHandler(c_MouseClick);
}
}
void c_MouseClick(object sender, MouseEventArgs e)
{
Control c = (Control)sender;
MessageBox.Show(c.GetType().FullName);
}
}
Hope this helps. Best regards. Rong-Chun Zhang |