增加「Help_DrawDropAdorner」的通用性

This commit is contained in:
zengwenjie
2025-09-26 15:48:08 +08:00
parent 25c5697d68
commit d2c23ab05c
2 changed files with 3 additions and 5 deletions

View File

@@ -35,6 +35,6 @@ namespace Deedy.Activity
}
protected override void OnRender(DrawingContext drawingContext)
=> this.Help_DrawDropAdorner(drawingContext, this.DropPlacement, this.LayoutDirection, _Pen, _Brush);
=> drawingContext.Help_DrawDropAdorner(this.AdornedElement.RenderSize, this.DropPlacement, this.LayoutDirection, _Pen, _Brush);
}
}

View File

@@ -20,18 +20,16 @@ namespace Deedy.Activity
/// <summary>
/// 辅助可视化单元进行拖放装饰器绘制操作
/// </summary>
/// <param name="ui">要绘制的「UIElement」元素</param>
/// <param name="dc">「UIElement」元素的绘图上下文</param>
/// <param name="dropPlacement">拖放操作的放置位置</param>
/// <param name="parentLayoutDirection">父级布局的布局方向</param>
public static void Help_DrawDropAdorner(this UIElement ui, DrawingContext dc,
public static void Help_DrawDropAdorner(this DrawingContext dc,Size size,
DropPlacement dropPlacement, LayoutDirection? parentLayoutDirection,
Pen? _Pen = null, Brush? _Brush = null)
{
if (ui == null || dc == null || dropPlacement == DropPlacement.UnDragged) return;
if (dc == null || dropPlacement == DropPlacement.UnDragged) return;
Pen pen = _Pen ?? new Pen(Brushes.Transparent, 0);
Brush brush = _Brush ?? new SolidColorBrush(Colors.Red) { Opacity = 0.5 };
Size size = ui.RenderSize;
ThemeResources res = new();
switch (dropPlacement)