我正在开发一个Windows窗体应用程序。为某些服务创建UI。发生的事情是当我创建应用程序时,有一些按钮,单击一下就可以获取并设置值,但是在完成代码之后,所有这些按钮都会响应双击。 当我们应用一些断点和测试时,仅在单击中获取和设置值,但在运行时它需要双击。有人可以帮忙吗?
答案 0 :(得分:0)
以下是来自MSDN的完整Article,关于如何仅使用单击而不是双击。此外,它还说明了如何处理事件并区分单击和双击。
本文使用布尔值和计时器来做到这一点。如果您有多个按钮,则可能需要使用hive> select max(IT1C1+IT1C2) from iitest1;
Query ID = root_20160713172448_09ccc9e6-c70d-4e56-b428-e511f62db9a6
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
set mapreduce.job.reduces=<number>
Starting Job = job_1468423564920_0003, Tracking URL = http://sandbox.hortonworks.com:8088/proxy/application_1468423564920_0003/
Kill Command = /usr/hdp/2.3.0.0-2557/hadoop/bin/hadoop job -kill job_1468423564920_0003
Interrupting... Be patient, this might take some time.
Press Ctrl+C again to kill JVM
killing job with: job_1468423564920_0003
Hadoop job information for Stage-1: number of mappers: 0; number of reducers: 0
2016-07-13 17:49:56,510 Stage-1 map = 0%, reduce = 0%
Ended Job = job_1468423564920_0003 with errors
Error during job, obtaining debugging information...
FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
MapReduce Jobs Launched:
Stage-Stage-1: HDFS Read: 0 HDFS Write: 0 FAIL
Total MapReduce CPU Time Spent: 0 msec
hive> exit
> ;
。希望它有所帮助。
以下是链接因某些原因而被删除或删除的示例:
处理MouseDown事件并确定位置和时间跨度 使用适当的SystemInformation属性和之间的点击之间 定时器组件。根据是否执行适当的操作 点击或双击发生。以下代码示例 演示如何做到这一点。
Dictionary<Button, boolean>
答案 1 :(得分:0)
您可以使用计时器简单地识别单击和双击。这是示例
class Form1 : Form
{
Timer timer;
public Form1()
{
InitializeComponent();
timer = new Timer();
timer.Interval = 500;
timer.Tick += new EventHandler(Timer_Tick);
}
private void App_MouseDown(object sender, MouseEventArgs e)
{
if (e.Clicks == 1)
{
timer.Start();
}
else
{
timer.Stop();
doubleClick();
}
}
private void Timer_Tick(object sender, EventArgs e)
{
timer.Stop();
singleClick();
}
//Single click
public void singleClick()
{
MessageBox.Show("Single Click.");
}
//Double click
public void doubleClick()
{
MessageBox.Show("Double Click.");
}
}
答案 2 :(得分:0)
我通过编写一段代码得到了解决方案。 只需在第一次点击时激活按钮。
bool firstClick = true; {if(firstClick){button.select(); //激活按钮}}
感谢大家的回复。