当我使用带有滚动条的任何控件(ListBox,Panel,TextBox)时,MouseWheel事件不会触发.
重现问题:
public class Form1 : Form
{
private readonly Button button1;
private readonly TextBox textBox1;
private void button1_MouseWheel(object sender, MouseEventArgs e)
{
ToString(); // doesn't fire when uncomment lines below
}
public Form1()
{
button1 = new Button();
textBox1 = new TextBox();
SuspendLayout();
button1.Location = new System.Drawing.Point(80, 105);
button1.Size = new System.Drawing.Size(75, 23);
button1.MouseWheel += button1_MouseWheel;
button1.Click += button1_Click;
textBox1.Location = new System.Drawing.Point(338, 105);
//textBox1.Multiline = true; // uncomment this
//textBox1.ScrollBars = ScrollBars.Vertical; // uncomment this
textBox1.Size = new …Run Code Online (Sandbox Code Playgroud) 我只需要在我的应用程序中使用用户空闲检测(每个"我的应用程序实例").
我不能使用GetLastInputInfo,因为是特定于会话的用户输入:
GetLastInputInfo 不在所有正在运行的会话中提供系统范围的用户输入信息.相反,GetLastInputInfo 仅为调用该函数的会话提供特定于会话的用户输入信息.
有什么建议 ?