RA2MapEditTool.Control/TitleBarUC.xaml.cs
(完整代码) 1KBusing System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
// 参考资料
// [1] https://blog.csdn.net/u013113678/article/details/121071628
namespace RA2MapEditTool.Control
{
/// <summary>
/// 标题栏控件
/// </summary>
public partial class TitleBarUC : UserControl
{
private bool IsDragMoved { get; set; } = false;
private Point PressedPosition { get; set; }
private Window ParentWindow { get; set; }
public TitleBarUC()
{
this.InitializeComponent();
}
private void TitlePanelUC_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.ParentWindow = Window.GetWindow(this);
this.PressedPosition = e.GetPosition(this);
//e.Handled = true;
}
private void TitlePanelUC_PreviewMouseMove(object sender, MouseEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Pressed &&
this.PressedPosition != e.GetPosition(this))
{
this.IsDragMoved = true;
this.ParentWindow.DragMove();
}
}
private void TitlePanelUC_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (this.IsDragMoved)
{
this.IsDragMoved = false;
e.Handled = true;
}
}
private void buttonClose_Click(object sender, RoutedEventArgs e) => this.ParentWindow.Close();
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。