2010-06-18 7 views
3

사용자가 왼쪽 버튼을 계속 누르고있는 동안 마우스를 특정 축을 따라 움직이게하려면 어떻게해야합니까? Y 축의 움직임이 "취소됨"동안 사용자가 X 축을 따라 마우스를 움직일 수 있기를 바랍니다.WPF에서 특정 축을 따라 마우스를 강제로 이동

덕분에 에덴

답변

1

확인이 : 링크에서 http://social.msdn.microsoft.com/Forums/en/wpf/thread/9b07abce-bb32-4cd1-9ae5-d34973d5cc95

:

public partial class MouseOperations 
{ 
    [System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "SetCursorPos")] 
    [return:System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]  
    public static extern bool SetCursorPos(int X, int Y); 
} 

당신은 Mouse.MouseMove event handler에서 메소드를 호출해야합니다.

MouseOperations.SetCursorPos(xAxisPosition,0); 
관련 문제