I have a winform application running , i added one more winform one top of this application which will pass some datas to the the application. After passing the datas to the application, Save button will be enabled to save data in to application. The save button is toolstripmenuitem. One issue i am facing is when the newly added form is still there, i need to click two times to save ie first click will not click properly . Or if i close the newly added winform then save click will happen first time itself or if i click any part of the exisitng application ie focus will be there ,then also first click will do.
Adding this method override to the form containing your tool strip should take care of it.
protected override void WndProc(ref Message m)
{
const int WM_PARENTNOTIFY = 0x0210;
if (m.Msg == WM_PARENTNOTIFY)
{
if (!Focused)
Activate();
}
base.WndProc(ref m);
}
The tool strip is performing the Activate call only, so by handling it ourselves it will perform the Click event
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With