小编hal*_*rty的帖子

使用任何带有滚动条的控件时,不会触发MouseWheel事件(在C#Windows窗体中)

当我使用带有滚动条的任何控件(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)

c# events scrollbar mousewheel winforms

13
推荐指数
2
解决办法
1万
查看次数

检测用户空闲(每个应用程序实例)

我只需要在我的应用程序中使用用户空闲检测(每个"我的应用程序实例").
我不能使用GetLastInputInfo,因为是特定于会话的用户输入:

GetLastInputInfo 不在所有正在运行的会话中提供系统范围的用户输入信息.相反,GetLastInputInfo 仅为调用该函数的会话提供特定会话的用户输入信息.

有什么建议 ?

.net c# idle-processing

5
推荐指数
2
解决办法
3486
查看次数

标签 统计

c# ×2

.net ×1

events ×1

idle-processing ×1

mousewheel ×1

scrollbar ×1

winforms ×1