diff --git a/WPF-重要示例.sln b/WPF-重要示例.sln index 1af13c4..bb4ace1 100644 --- a/WPF-重要示例.sln +++ b/WPF-重要示例.sln @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_6InCanvas鼠标绘制", "_ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_7鼠标状态移动监视", "_7鼠标状态移动监视\_7鼠标状态移动监视.csproj", "{73A72017-2AC5-4C62-8456-8070C586CBC4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_8鼠标拖拽", "_8鼠标拖拽\_8鼠标拖拽.csproj", "{2B87A81A-A1B0-4243-92BD-1281097B79E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,5 +50,9 @@ Global {73A72017-2AC5-4C62-8456-8070C586CBC4}.Debug|Any CPU.Build.0 = Debug|Any CPU {73A72017-2AC5-4C62-8456-8070C586CBC4}.Release|Any CPU.ActiveCfg = Release|Any CPU {73A72017-2AC5-4C62-8456-8070C586CBC4}.Release|Any CPU.Build.0 = Release|Any CPU + {2B87A81A-A1B0-4243-92BD-1281097B79E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B87A81A-A1B0-4243-92BD-1281097B79E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B87A81A-A1B0-4243-92BD-1281097B79E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B87A81A-A1B0-4243-92BD-1281097B79E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/_8鼠标拖拽/App.xaml b/_8鼠标拖拽/App.xaml new file mode 100644 index 0000000..e7ba25e --- /dev/null +++ b/_8鼠标拖拽/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/_8鼠标拖拽/App.xaml.cs b/_8鼠标拖拽/App.xaml.cs new file mode 100644 index 0000000..ccfd3f1 --- /dev/null +++ b/_8鼠标拖拽/App.xaml.cs @@ -0,0 +1,12 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace _8鼠标拖拽; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} \ No newline at end of file diff --git a/_8鼠标拖拽/AssemblyInfo.cs b/_8鼠标拖拽/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/_8鼠标拖拽/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] \ No newline at end of file diff --git a/_8鼠标拖拽/MainWindow.xaml b/_8鼠标拖拽/MainWindow.xaml new file mode 100644 index 0000000..121a940 --- /dev/null +++ b/_8鼠标拖拽/MainWindow.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/_8鼠标拖拽/MainWindow.xaml.cs b/_8鼠标拖拽/MainWindow.xaml.cs new file mode 100644 index 0000000..299b2d2 --- /dev/null +++ b/_8鼠标拖拽/MainWindow.xaml.cs @@ -0,0 +1,27 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace _8鼠标拖拽; + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } + + private void LabelDrop1_OnDrop(object sender, DragEventArgs e) + { + e.Effects = e.Data.GetDataPresent(DataFormats.Text) ? DragDropEffects.Copy : DragDropEffects.None; + } + + private void LabelDrop1_OnMouseDown(object sender, MouseButtonEventArgs e) + { + var label = (Label)sender; + DragDrop.DoDragDrop(label, LabelDrop1.Content, DragDropEffects.Copy); + } +} \ No newline at end of file diff --git a/_8鼠标拖拽/_8鼠标拖拽.csproj b/_8鼠标拖拽/_8鼠标拖拽.csproj new file mode 100644 index 0000000..2735ba6 --- /dev/null +++ b/_8鼠标拖拽/_8鼠标拖拽.csproj @@ -0,0 +1,17 @@ + + + + WinExe + net8.0-windows + enable + enable + true + + + + + Always + + + + diff --git a/_8鼠标拖拽/public/logo.png b/_8鼠标拖拽/public/logo.png new file mode 100644 index 0000000..5dedbe2 Binary files /dev/null and b/_8鼠标拖拽/public/logo.png differ