[C# / WPF] 드래그 앤 드롭으로 이미지 움직이기


[C# / WPF] 드래그 앤 드롭으로 이미지 움직이기

<Grid> <ScrollViewer> <Canvas> <Image ... /> <Canvas/> </ScrollViewer> <Grid> XAML은 대략 위와 같은 구조이고 Image를 클릭하여 드래그 앤 드롭으로 이미지를 움직이고 싶었다. private System.Windows.Point mousePoint = new System.Windows.Point(); private void canvas_PreviewMouseLeftButton(object sender, Input.MouseButtonEventArgs e) { this.mousePoint = e.GetPosition(this.scrollViewer); this.hOff = this.scrollViewer.HorizontalOffset; this.vOff = this.scrollViewer.VerticalOffset; this.canvas.CaptureMouse(); } 위 코드는 Image를 클릭했을 때 이벤트로 클릭한...


#and #앤 #드롭 #드래그 #WPF #ScrollViewer #Release #Mouse #Image #GetPosition #Function #Drop #Drag #CSharp #Capture #Canvas #이미지 #움직이기

원문링크 : [C# / WPF] 드래그 앤 드롭으로 이미지 움직이기