• wpf控件拖动


    Thumb 拖动 上代码!

     1 <Window x:Class="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 Name="grid">
    10         <Grid Height="50" Width="50" Background="Red">
    11             <Thumb DragDelta="Thumb_DragDelta" Opacity="0">
    12        
    13         </Thumb>
    14         </Grid>
    15     </Grid>
    16 </Window>
    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         }

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

  • 相关阅读:
    逝华
    数论知识
    #10081. 「一本通 3.2 练习 7」道路和航线 题解
    Tire 字典树
    Manacher算法
    时间变奏曲
    【算法】莫队
    【算法】深度优先搜索(dfs)
    【算法】数位 dp
    【笔记】关于位运算(2)
  • 原文地址:https://www.cnblogs.com/pu-tao-zi/p/9531332.html
Copyright © 2020-2023  润新知