/* * ListBox鼠标按下 */ private void listbox_PreviewMouseDown(object sender, MouseEventArgs e) { isMoving = false; storyboard.Seek(TimeSpan.FromMilliseconds(400)); ListBox listbox1 = (ListBox)sender; ScrollViewer sv = FindVisualChild <ScrollViewer>(listbox1); isMouseDown = true; startX = e.GetPosition(this).X; controlX = e.GetPosition(this).X; // this.offsetLeft = sv.HorizontalOffset; offsetLeft = turnImageWhich * listbox1.Width; moveX = 0; turnImage_Timer.Stop(); // listbox1.CaptureMouse(); //textbox1.Text = "开始拖动" + offsetLeft; listbox1.CaptureMouse(); e.Handled = true; }