2
에 드래그 델타을 구현 가야합니까, 나는 다음과 같은 코드가 다음 DragDeltaEvent의 인수에 대한 지금어떻게 내가 모양에 드래그 델타을 구현 가야합니까 어떻게 모양
void Connector_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
{
this.Focus();
this.CaptureMouse();
this.RaiseEvent(new DragStartedEventArgs(0,0));
initMousePoint = e.GetPosition(this);
}
e.Handled = true;
}
void Shape2_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
currMousePoint = e.GetPosition(this);
if (this.IsMouseCaptured)
{
this.RaiseEvent(new DragDeltaEventArgs(0,0);
}
}
void Shape2_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.ReleaseMouseCapture();
}
을 내가 계산해야합니까 mousemove에서 드래그하여 이벤트에 전달하면 이벤트를 발생시키는 올바른 방법이기도합니다. 이 방법이 효과가 있다면 드래그 델타 이벤트 만 구독하고 엄지 손가락으로 사용해야합니다. 이 답변이 나를 돕지 않는다는 것을 전제로, 모양으로 엄지 손가락을 템플릿으로 만들고 싶지 않습니다.
노트에 대한 chagnes는이 요소가 아니라 포함 된 패널에 위치를 얻을 수 있기 때문에 마우스의 위치, 이것은 내가 일을 생각하지 않는다지고, 그래서 난을 생각하지 않는다 이런 식으로 드래그 거리를 찾을 수 있습니다.
currMousePoint = e.GetPosition(this);
double dragHorizontal = currMousePoint.X - initMousePoint.X;
double dragVertical = currMousePoint.Y - initMousePoint.Y;
//Set the new canvas top and left proeprties here.
내가 마우스 이동 이벤트를 넣고 코드를 사용하여 그것을 해결 : – mihajlv