整理
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// 可裁剪 Boder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// 装饰基类,用于创建具有特定视觉效果的控件。
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:cvt="clr-namespace:NeumUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeumUI.Converters.Internal"
|
||||
xmlns:svd="clr-namespace:NeumUI.Controls.Decorations"
|
||||
xmlns:cvt="clr-namespace:NeoUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type svd:EmbossBorder}">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// 浮雕边框
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Windows.Media.Effects;
|
||||
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// GlassChromeDecorator 类用于创建具有玻璃效果的装饰器。该类继承自 Decorator,提供了背景、边框画刷、边框厚度、圆角半径以及外部阴影效果等属性,以实现现代化且美观的用户界面元素。
|
||||
@@ -27,50 +27,101 @@ public class GlassChromeDecorator : Decorator
|
||||
|
||||
#region Dependency Properties
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BackgroundProperty =
|
||||
DependencyProperty.Register(nameof(Background), typeof(Brush), typeof(GlassChromeDecorator),
|
||||
new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromArgb(0x26, 0xFF, 0xFF, 0xFF)), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
/// <summary>
|
||||
/// 表示控件背景的画刷。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 该属性定义了GlassChromeDecorator控件的背景颜色和样式。当此属性发生变化时,将影响控件的渲染。
|
||||
/// 默认值为一个具有特定透明度的颜色的SolidColorBrush。
|
||||
/// </remarks>
|
||||
public Brush Background
|
||||
{
|
||||
get => (Brush)GetValue(BackgroundProperty);
|
||||
set => SetValue(BackgroundProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示用于绘制边框的画刷的依赖属性。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 该属性定义了GlassChromeDecorator控件边框的颜色和样式。当此属性发生变化时,将影响控件的渲染。
|
||||
/// 默认值为一个具有特定颜色透明度的SolidColorBrush。
|
||||
/// </remarks>
|
||||
public static readonly DependencyProperty BorderBrushProperty =
|
||||
DependencyProperty.Register(nameof(BorderBrush), typeof(Brush), typeof(GlassChromeDecorator),
|
||||
new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromArgb(0x4C, 0xFF, 0xFF, 0xFF)), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用于绘制边框的画刷。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 此属性允许您指定一个画刷,该画刷将用于渲染控件的边框。通过修改此属性,您可以改变边框的颜色、渐变或其他视觉效果。
|
||||
/// 默认值为半透明的白色(ARGB: 0x4CFFFFFF)。
|
||||
/// </remarks>
|
||||
public Brush BorderBrush
|
||||
{
|
||||
get => (Brush)GetValue(BorderBrushProperty);
|
||||
set => SetValue(BorderBrushProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示边框厚度的依赖属性。此属性影响渲染,其默认值为 1。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BorderThicknessProperty =
|
||||
DependencyProperty.Register(nameof(BorderThickness), typeof(Thickness), typeof(GlassChromeDecorator),
|
||||
new FrameworkPropertyMetadata(new Thickness(1), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Thickness BorderThickness
|
||||
{
|
||||
get => (Thickness)GetValue(BorderThicknessProperty);
|
||||
set => SetValue(BorderThicknessProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CornerRadiusProperty =
|
||||
DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(GlassChromeDecorator),
|
||||
new FrameworkPropertyMetadata(new CornerRadius(20), FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public CornerRadius CornerRadius
|
||||
{
|
||||
get => (CornerRadius)GetValue(CornerRadiusProperty);
|
||||
set => SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示控件外部阴影效果的属性。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 该属性定义了GlassChromeDecorator控件的外部阴影效果。通过设置此属性,可以自定义控件的阴影外观,如阴影深度、模糊半径和颜色等。默认值为一个具有特定参数的DropShadowEffect实例。
|
||||
/// 当此属性发生变化时,将影响控件的渲染。
|
||||
/// </remarks>
|
||||
public static readonly DependencyProperty OuterShadowEffectProperty =
|
||||
DependencyProperty.Register(nameof(OuterShadowEffect), typeof(Effect), typeof(GlassChromeDecorator),
|
||||
new PropertyMetadata(new DropShadowEffect { ShadowDepth = 8, BlurRadius = 32, Color = Color.FromArgb(0x1A, 0, 0, 0) }));
|
||||
|
||||
/// <summary>
|
||||
/// 表示控件外阴影效果。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 该属性定义了GlassChromeDecorator控件的外阴影样式。通过设置不同的Effect对象,可以改变控件边缘的阴影外观。
|
||||
/// 默认值为一个具有特定模糊半径、阴影深度和颜色的DropShadowEffect实例。
|
||||
/// 当此属性发生变化时,将影响控件的整体视觉表现。
|
||||
/// </remarks>
|
||||
public Effect OuterShadowEffect
|
||||
{
|
||||
get => (Effect)GetValue(OuterShadowEffectProperty);
|
||||
@@ -80,6 +131,9 @@ public class GlassChromeDecorator : Decorator
|
||||
#endregion
|
||||
|
||||
// 构造函数中应用外阴影
|
||||
/// <summary>
|
||||
/// GlassChromeDecorator 类用于创建具有玻璃效果和自定义边框的装饰器。此控件扩展了 WPF 的 Decorator 类,允许用户通过设置属性来自定义背景色、边框颜色、边框厚度、圆角半径以及外阴影效果。
|
||||
/// </summary>
|
||||
public GlassChromeDecorator()
|
||||
{
|
||||
// 将外阴影效果绑定到控件自身
|
||||
@@ -88,6 +142,7 @@ public class GlassChromeDecorator : Decorator
|
||||
|
||||
|
||||
// 关键的 OnRender 方法,所有绘图逻辑都在这里
|
||||
/// <inheritdoc />
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
// 确保我们有有效的绘制区域
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:svd="clr-namespace:NeumUI.Controls.Decorations"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type svd:LightedSurface}">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Input;
|
||||
using NeumUI.Effects;
|
||||
using NeoUI.Effects;
|
||||
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// LightedSurface 控件继承自 ContentControl,用于创建具有光照效果的表面。该控件支持鼠标移动时的动态光照反应,
|
||||
@@ -78,7 +78,7 @@ public class LightedSurface : ContentControl
|
||||
|
||||
/// <summary>
|
||||
/// 当 LightedSurface 控件的光照颜色属性值发生变化时调用此回调方法。
|
||||
/// </方法会更新与控件关联的效果中的光照颜色。
|
||||
/// 方法会更新与控件关联的效果中的光照颜色。
|
||||
/// </summary>
|
||||
/// <param name="d">触发属性更改的依赖对象,此处应为 LightedSurface 的一个实例。</param>
|
||||
/// <param name="e">包含有关属性更改的信息,包括新旧值。</param>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:conv="clr-namespace:NeumUI.Converters"
|
||||
xmlns:dec="clr-namespace:NeumUI.Controls.Decorations"
|
||||
xmlns:internal="clr-namespace:NeumUI.Converters.Internal"
|
||||
xmlns:conv="clr-namespace:NeoUI.Converters"
|
||||
xmlns:dec="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type dec:SlotBorder}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace NeumUI.Controls.Decorations;
|
||||
namespace NeoUI.Controls.Decorations;
|
||||
|
||||
/// <summary>
|
||||
/// SlotBorder 类继承自 DecorationBase,用于为控件添加具有圆角和阴影效果的装饰边框。
|
||||
|
||||
Reference in New Issue
Block a user