增加「Help_DrawDropAdorner」的通用性
This commit is contained in:
@@ -35,6 +35,6 @@ namespace Deedy.Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRender(DrawingContext drawingContext)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,16 @@ namespace Deedy.Activity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 辅助可视化单元进行拖放装饰器绘制操作
|
/// 辅助可视化单元进行拖放装饰器绘制操作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ui">要绘制的「UIElement」元素</param>
|
|
||||||
/// <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 UIElement ui, DrawingContext dc,
|
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)
|
||||||
{
|
{
|
||||||
if (ui == null || dc == null || dropPlacement == DropPlacement.UnDragged) return;
|
if (dc == null || dropPlacement == DropPlacement.UnDragged) return;
|
||||||
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 };
|
||||||
Size size = ui.RenderSize;
|
|
||||||
ThemeResources res = new();
|
ThemeResources res = new();
|
||||||
|
|
||||||
switch (dropPlacement)
|
switch (dropPlacement)
|
||||||
|
|||||||
Reference in New Issue
Block a user