ScreenToGif/Controls/DragScrollGrid.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace ScreenToGif.Controls
{
/// <summary>
/// Scroll by Drag Grid
/// TODO: Make a grid that reacts to the drag sideway to increase or decrease a number.
/// </summary>
public class DragScrollGrid : Grid
{
#region Variables
private Point _lastPosition;
public static readonly DependencyProperty IsDraggableProperty;
#endregion
#region Properties
/// <summary>
/// If true, will enable te value increase/decrease by sideway drag.
/// </summary>
public bool IsDraggable
{
get { return (bool)GetValue(IsDraggableProperty); }
set { SetValue(IsDraggableProperty, value); }
}
#endregion
static DragScrollGrid()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DragScrollGrid), new FrameworkPropertyMetadata(typeof(DragScrollGrid)));
IsDraggableProperty = DependencyProperty.Register("IsDraggable", typeof(bool), typeof(DragScrollGrid), new PropertyMetadata(false));
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
MouseDown += DragScrollGrid_MouseDown;
MouseMove += DragScrollGrid_MouseMove;
MouseUp += DragScrollGrid_MouseUp;
}
#region Events
private void DragScrollGrid_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Mouse.Capture(this);
后面还有 27 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
