wpf控件拖动

Thumb 拖动 上代码!

 1 "Thumb控件移动.MainWindow"
 2         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 5         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 6         xmlns:local="clr-namespace:Thumb控件移动"
 7         mc:Ignorable="d"
 8         Title="MainWindow" Height="350" Width="525">
 9     "grid">
10         "50" Width="50" Background="Red">
11             "Thumb_DragDelta" Opacity="0">
12        
13         
14         
15     
16 
1         private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
2         {
3             Thickness margin = grid.Margin;
4             margin.Top += e.VerticalChange;
5             margin.Bottom -= e.VerticalChange;
6             margin.Left += e.HorizontalChange;
7             margin.Right -= e.HorizontalChange;
8             grid.Margin = margin;
9         }

好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!好了可以愉快的拖动了!!!!!!!!!!!!!!!

转载于:https://www.cnblogs.com/pu-tao-zi/p/9531332.html

你可能感兴趣的:(wpf控件拖动)