为拖放装饰器辅助方法创建代办任务

This commit is contained in:
zengwenjie
2025-09-26 16:39:07 +08:00
parent d2c23ab05c
commit 6496742520
4 changed files with 12 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ namespace Deedy.Activity
/// <param name="dc">「UIElement」元素的绘图上下文</param> /// <param name="dc">「UIElement」元素的绘图上下文</param>
/// <param name="dropPlacement">拖放操作的放置位置</param> /// <param name="dropPlacement">拖放操作的放置位置</param>
/// <param name="parentLayoutDirection">父级布局的布局方向</param> /// <param name="parentLayoutDirection">父级布局的布局方向</param>
public static void Help_DrawDropAdorner(this DrawingContext dc,Size size, public static void Help_DrawDropAdorner(this DrawingContext dc, Size size,
DropPlacement dropPlacement, LayoutDirection? parentLayoutDirection, DropPlacement dropPlacement, LayoutDirection? parentLayoutDirection,
Pen? _Pen = null, Brush? _Brush = null) Pen? _Pen = null, Brush? _Brush = null)
{ {
@@ -31,7 +31,7 @@ namespace Deedy.Activity
Pen pen = _Pen ?? new Pen(Brushes.Transparent, 0); Pen pen = _Pen ?? new Pen(Brushes.Transparent, 0);
Brush brush = _Brush ?? new SolidColorBrush(Colors.Red) { Opacity = 0.5 }; Brush brush = _Brush ?? new SolidColorBrush(Colors.Red) { Opacity = 0.5 };
ThemeResources res = new(); ThemeResources res = new();
//TODO调整拖放示例矢量图的绘制位置
switch (dropPlacement) switch (dropPlacement)
{ {
case DropPlacement.Rejected: case DropPlacement.Rejected:
@@ -88,9 +88,9 @@ namespace Deedy.Activity
if (element != null) if (element != null)
{ {
double horRuler = size.Width / 4; double horRuler = size.Width / 4;
if (horRuler > 20) horRuler = 20; if (horRuler > 24) horRuler = 24;
double verRuler = size.Height / 4; double verRuler = size.Height / 4;
if (verRuler > 20) verRuler = 20; if (verRuler > 24) verRuler = 24;
LayoutDirection direction = LayoutDirection.Cannot; LayoutDirection direction = LayoutDirection.Cannot;
if (element is ICombinedElement) if (element is ICombinedElement)
{ {
@@ -155,7 +155,7 @@ namespace Deedy.Activity
/// <param name="rectangle">目标位置</param> /// <param name="rectangle">目标位置</param>
/// <param name="angle">旋转角度</param> /// <param name="angle">旋转角度</param>
/// <returns>克隆平移后的新矢量图形</returns> /// <returns>克隆平移后的新矢量图形</returns>
public static Geometry Help_MappingToBounds(this Geometry geometry, double angle, Rect rectangle) public static Geometry Help_MappingToBounds(this Geometry geometry, Rect rectangle, double angle = 0)
{ {
Geometry newGeometry = geometry.Clone(); Geometry newGeometry = geometry.Clone();
newGeometry.Transform = new TransformGroup newGeometry.Transform = new TransformGroup

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -27,6 +28,7 @@ namespace Deedy.Activity
public const string DropIcon_BringForward = "DropIcon_BringForward"; // 上移一层 public const string DropIcon_BringForward = "DropIcon_BringForward"; // 上移一层
public const string DropIcon_SendBackward = "DropIcon_SendBackward"; // 下移一层 public const string DropIcon_SendBackward = "DropIcon_SendBackward"; // 下移一层
public const string DropIcon_InsideOneself = "DropIcon_InsideOneself"; // 自身内部 public const string DropIcon_InsideOneself = "DropIcon_InsideOneself"; // 自身内部
public const string DropIcon_BeforeOrBehind = "DropIcon_BeforeOrBehind"; // 自身前后
public const string DropIcon_ReplaceOneself = "DropIcon_ReplaceOneself"; // 替换自身 public const string DropIcon_ReplaceOneself = "DropIcon_ReplaceOneself"; // 替换自身
public const string DropIcon_LinkWithOneself = "DropIcon_LinkWithOneself"; // 链接自身 public const string DropIcon_LinkWithOneself = "DropIcon_LinkWithOneself"; // 链接自身
public const string DropIcon_RejectDragDrop = "DropIcon_RejectDragDrop"; // 决绝拖放 public const string DropIcon_RejectDragDrop = "DropIcon_RejectDragDrop"; // 决绝拖放
@@ -54,6 +56,7 @@ namespace Deedy.Activity
public static ComponentResourceKey DropIcon_BringForward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_BringForward); public static ComponentResourceKey DropIcon_BringForward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_BringForward);
public static ComponentResourceKey DropIcon_SendBackward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_SendBackward); public static ComponentResourceKey DropIcon_SendBackward = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_SendBackward);
public static ComponentResourceKey DropIcon_InsideOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_InsideOneself); public static ComponentResourceKey DropIcon_InsideOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_InsideOneself);
public static ComponentResourceKey DropIcon_BeforeOrBehind = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_BeforeOrBehind);
public static ComponentResourceKey DropIcon_ReplaceOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_ReplaceOneself); public static ComponentResourceKey DropIcon_ReplaceOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_ReplaceOneself);
public static ComponentResourceKey DropIcon_LinkWithOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_LinkWithOneself); public static ComponentResourceKey DropIcon_LinkWithOneself = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_LinkWithOneself);
public static ComponentResourceKey DropIcon_RejectDragDrop = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_RejectDragDrop); public static ComponentResourceKey DropIcon_RejectDragDrop = new ComponentResourceKey(typeof(ThemeKeys), Keys.DropIcon_RejectDragDrop);

View File

@@ -25,6 +25,7 @@ namespace Deedy.Activity
public PathGeometry? DropIcon_BringForward => this[ThemeKeys.DropIcon_BringForward] as PathGeometry; public PathGeometry? DropIcon_BringForward => this[ThemeKeys.DropIcon_BringForward] as PathGeometry;
public PathGeometry? DropIcon_SendBackward => this[ThemeKeys.DropIcon_SendBackward] as PathGeometry; public PathGeometry? DropIcon_SendBackward => this[ThemeKeys.DropIcon_SendBackward] as PathGeometry;
public PathGeometry? DropIcon_InsideOneself => this[ThemeKeys.DropIcon_InsideOneself] as PathGeometry; public PathGeometry? DropIcon_InsideOneself => this[ThemeKeys.DropIcon_InsideOneself] as PathGeometry;
public PathGeometry? DropIcon_BeforeOrBehind => this[ThemeKeys.DropIcon_BeforeOrBehind] as PathGeometry;
public PathGeometry? DropIcon_ReplaceOneself => this[ThemeKeys.DropIcon_ReplaceOneself] as PathGeometry; public PathGeometry? DropIcon_ReplaceOneself => this[ThemeKeys.DropIcon_ReplaceOneself] as PathGeometry;
public PathGeometry? DropIcon_LinkWithOneself => this[ThemeKeys.DropIcon_LinkWithOneself] as PathGeometry; public PathGeometry? DropIcon_LinkWithOneself => this[ThemeKeys.DropIcon_LinkWithOneself] as PathGeometry;
public PathGeometry? DropIcon_RejectDragDrop => this[ThemeKeys.DropIcon_RejectDragDrop] as PathGeometry; public PathGeometry? DropIcon_RejectDragDrop => this[ThemeKeys.DropIcon_RejectDragDrop] as PathGeometry;

View File

@@ -72,6 +72,9 @@
<PathGeometry x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:ThemeKeys},ResourceId=DropIcon_InsideOneself}"> <PathGeometry x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:ThemeKeys},ResourceId=DropIcon_InsideOneself}">
M 14 3 H 17 L 12 8 L 7 3 H 10 V 0 H 14 V 3 Z M 10 21 H 7 L 12 16 L 17 21 H 14 V 24 H 10 V 21 Z M 3 10 V 7 L 8 12 L 3 17 V 14 H 0 V 10 H 3 Z M 21 14 V 17 L 16 12 L 21 7 V 10 H 24 V 14 H 21 Z M 14 3 H 17 L 12 8 L 7 3 H 10 V 0 H 14 V 3 Z M 10 21 H 7 L 12 16 L 17 21 H 14 V 24 H 10 V 21 Z M 3 10 V 7 L 8 12 L 3 17 V 14 H 0 V 10 H 3 Z M 21 14 V 17 L 16 12 L 21 7 V 10 H 24 V 14 H 21 Z
</PathGeometry> </PathGeometry>
<PathGeometry x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:ThemeKeys},ResourceId=DropIcon_BeforeOrBehind}">
M 0 0 H 24 V 4 H 0 Z M 12 6 L 0 14 L 12 11 L 24 14 Z M 12 13 L 0 24 L 12 18 L 24 24 Z
</PathGeometry>
<PathGeometry x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:ThemeKeys},ResourceId=DropIcon_ReplaceOneself}"> <PathGeometry x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:ThemeKeys},ResourceId=DropIcon_ReplaceOneself}">
M 23 12 c 0 1.042 -0.154 2.045 -0.425 3 h -2.101 c 0.335 -0.94 0.526 -1.947 0.526 -3 c 0 -4.962 -4.037 -9 -9 -9 c -1.706 0 -3.296 0.484 -4.655 1.314 l 1.858 2.686 h -6.994 l 2.152 -7 l 1.849 2.673 c 1.684 -1.049 3.659 -1.673 5.79 -1.673 c 6.074 0 11 4.925 11 11 z m -6.354 7.692 c -1.357 0.826 -2.944 1.308 -4.646 1.308 c -4.962 0 -9 -4.038 -9 -9 c 0 -1.053 0.191 -2.06 0.525 -3 h -2.1 c -0.271 0.955 -0.425 1.958 -0.425 3 c 0 6.075 4.925 11 11 11 c 2.127 0 4.099 -0.621 5.78 -1.667 l 1.853 2.667 l 2.152 -6.989 h -6.994 l 1.855 2.681 z m -3.646 -5.692 h -2 v -7 h 2 v 7 z m 0 1 h -2 v 2 h 2 v -2 z M 0 0 V 24 H 24 H 0 M 23 12 c 0 1.042 -0.154 2.045 -0.425 3 h -2.101 c 0.335 -0.94 0.526 -1.947 0.526 -3 c 0 -4.962 -4.037 -9 -9 -9 c -1.706 0 -3.296 0.484 -4.655 1.314 l 1.858 2.686 h -6.994 l 2.152 -7 l 1.849 2.673 c 1.684 -1.049 3.659 -1.673 5.79 -1.673 c 6.074 0 11 4.925 11 11 z m -6.354 7.692 c -1.357 0.826 -2.944 1.308 -4.646 1.308 c -4.962 0 -9 -4.038 -9 -9 c 0 -1.053 0.191 -2.06 0.525 -3 h -2.1 c -0.271 0.955 -0.425 1.958 -0.425 3 c 0 6.075 4.925 11 11 11 c 2.127 0 4.099 -0.621 5.78 -1.667 l 1.853 2.667 l 2.152 -6.989 h -6.994 l 1.855 2.681 z m -3.646 -5.692 h -2 v -7 h 2 v 7 z m 0 1 h -2 v 2 h 2 v -2 z M 0 0 V 24 H 24 H 0
</PathGeometry> </PathGeometry>