Hi fwxf,
欢迎来到MSDN论坛!
ProgressBar 控件不引发MouseDoubleClick
事件.
请参考下面的MSDN链接:
ProgressBar.DoubleClick 事件
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.progressbar.doubleclick.aspx
您可以处理 MouseDown事件,来确定两次“单击”的位置和事件,以判断是否为双击。
请您参考下面的链接:
How to: Distinguish Between Clicks and Double-Clicks
http://msdn.microsoft.com/en-us/library/ms171543.aspx
下面是主要代码:
// Detect a valid single click or double click.
void Form1_MouseDown(object sender, MouseEventArgs e)
{
…
// This is the first mouse click.
if (isFirstClick)
{
isFirstClick = false;
// Determine the location and size of the double click
// rectangle area to draw around the cursor point.
doubleClickRectangle = new Rectangle(
e.X - (SystemInformation.DoubleClickSize.Width / 2),
e.Y - (SystemInformation.DoubleClickSize.Height / 2),
SystemInformation.DoubleClickSize.Width,
SystemInformation.DoubleClickSize.Height);
Invalidate();
// Start the double click timer.
doubleClickTimer.Start();
}
// This is the second mouse click.
else
{
// Verify that the mouse click is within the double click
// rectangle and is within the system-defined double
// click period.
if (doubleClickRectangle.Contains(e.Location) &&
milliseconds < SystemInformation.DoubleClickTime)
{
isDoubleClick = true;
}
}
}
祝,一切顺利!
Yoyo Jiang[MSFT]
MSDN Community Support |
Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
