The control is a Button. This is a Help button. After clicking the button the user can then move the mouse to the ListView and click on an Item and get detailed information.
So, here is my problem, the Mouse is captured and the aforementioned code works, though I think it's rather tacky, but I feel there is a better way to release the mouse capture.
I have tried ReleaseCapture(); to no avail.
Seems that if I do an Initialize(); or SendKeys.Send("+{TAB}"); the capture is released.
Either of those I feel is not the correct way.
Can you provide any insight as to how to release the mouse capture.
If you suggest a SendMessage, I would appreciate it if you could provide all the parameters and constants required otherwise I'll have to Google my brains out.
I'm a rather noob at C# but not new to programming.

Thank you in advance.

private void btnHelp_MouseUp(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Left)
			{
				tltpControlCenter.Active = false;
				HelpText = "Help";
				Cursor = Cursors.Help;
				SendKeys.Send("+{TAB}");	// Tacky, but works for now.
			}
		}

Recommended Answers

All 3 Replies

have you tried control.Capture = false; ?

ref

.NET Framework Class Library
Control..::.Capture Property
Gets or sets a value indicating whether the control has captured the mouse.

No go. No shortcut keys e.g. Escape are seen. I was trying to allow the user to cancel the 'Help' feature.

Problem solved. I added the MouseLeave event and then did a ListView.Focus and the capture is released.
Thanks for the help you provided, it got me thinking again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.