为什么仅在 MouseDown 事件中单击鼠标左键时才会触发 MouseMove 事件?
要么我不完全理解事件是如何运作的,要么Delphi Prism已经疯了!
我有一个 winform、mousedown 事件和 mousemove 事件。每当我仅单击鼠标左键时,MouseDown 事件就会按预期触发,但 MouseMove 事件也会在不应该触发的情况下立即触发。
这是我的 winform 设计器的一段代码,其中方法被分配给事件。
self.ClientSize := new System.Drawing.Size(751, 502);
self.KeyPreview := true;
self.Name := 'Maker';
self.Text := 'Window Maker';
self.Load += new System.EventHandler(@self.Maker_Load);
self.FormClosing += new System.Windows.Forms.FormClosingEventHandler(@self.Maker_FormClosing);
self.Shown += new System.EventHandler(@self.Maker_Shown);
self.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseDoubleClick);
self.MouseDown += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseDown);
self.MouseMove += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseMove);
self.MouseUp += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseUp);
self.Paint += new System.Windows.Forms.PaintEventHandler(@self.Maker_Paint);
self.ObjectPopup.ResumeLayout(false);
self.ResumeLayout(false);
我做错了什么?请帮助我对此感到沮丧,因为我的程序的其他部分有 mousemove 事件。他们工作得很好。我似乎无法弄清楚为什么这个特定的鼠标移动事件会发生。
Either I am not totally understanding how events work or Delphi Prism has gone mad!!!
I have a winform, mousedown event and mousemove event. Whenever I click the left mouse button only, MouseDown event fires as expected but ALSO MouseMove event fires right after when it is not suppose to.
Here is the piece of code from my winform designer where the methods are assigned to events.
self.ClientSize := new System.Drawing.Size(751, 502);
self.KeyPreview := true;
self.Name := 'Maker';
self.Text := 'Window Maker';
self.Load += new System.EventHandler(@self.Maker_Load);
self.FormClosing += new System.Windows.Forms.FormClosingEventHandler(@self.Maker_FormClosing);
self.Shown += new System.EventHandler(@self.Maker_Shown);
self.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseDoubleClick);
self.MouseDown += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseDown);
self.MouseMove += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseMove);
self.MouseUp += new System.Windows.Forms.MouseEventHandler(@self.Maker_MouseUp);
self.Paint += new System.Windows.Forms.PaintEventHandler(@self.Maker_Paint);
self.ObjectPopup.ResumeLayout(false);
self.ResumeLayout(false);
What am I doing wrong? Please, help I am getting frustrated over this, because I have mousemove events in other parts of my program. They work fine. I can't seem to figure out why this perticular mousemove event is acting up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我忘记了发生这种情况的原因。
但对于一个可能的解决方法:
I forget the reason that happens.
But for a possible work around: