2013-05-23 4 views
4

나는 myElement을 포함하는 MainPanel입니다. 패널에서 마우스 단추를 누른 채로 myElement 위로 이동하면 myElement_MouseMove이 호출되지 않습니다.마우스 버튼을 누르고있는 동안 MouseMove 이벤트가 표시되지 않는 이유는 무엇입니까?

마우스 버튼을 누르고 있지 않을 때 작동합니다.

마우스 버튼을 눌렀을 때 마우스 움직임을 어떻게 감지합니까?

this.MainPanel.Controls.Add(this.myElement); 
this.MainPanel.Location = new System.Drawing.Point(182, 84); 
this.MainPanel.Name = "MainPanel"; 
this.MainPanel.Size = new System.Drawing.Size(604, 309); 
this.MainPanel.TabIndex = 0; 

// 
// myElement 
// 
this.myElement.Location = new System.Drawing.Point(220, 67); 
this.myElement.Name = "myElement"; 
this.myElement.Size = new System.Drawing.Size(200, 100); 
this.myElement.TabIndex = 0;  

답변

5

드래그 이벤트는 마우스를 누르는 동안 발생하기 때문에 생각합니다. 따라서 마우스 버튼을 누른 상태에서 마우스가 컨트롤에 들어가면 drag enter 이벤트가 발생합니다.

드래그 이벤트 중 하나를 사용하여 마우스 움직임을 감지 할 수 있습니다. DragEnter, DragOver, DragLeave.

편집 : DoDragDrop disables MouseMove Events

관련 문제