2025-03-28 09:49:56 +08:00

85 lines
2.6 KiB
C#

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace HiiShe.WPFUI.Controls
{
public class HSButton : Button
{
public static readonly DependencyProperty MyMoverBrushProperty;
public static readonly DependencyProperty MyEnterBrushProperty;
public Brush MyMoverBrush
{
get
{
return base.GetValue(HSButton.MyMoverBrushProperty) as Brush;
}
set
{
base.SetValue(HSButton.MyMoverBrushProperty, value);
}
}
public Brush MyEnterBrush
{
get
{
return base.GetValue(HSButton.MyEnterBrushProperty) as Brush;
}
set
{
base.SetValue(HSButton.MyEnterBrushProperty, value);
}
}
static HSButton()
{
HSButton.MyMoverBrushProperty = DependencyProperty.Register("MyMoverBrush", typeof(Brush), typeof(HSButton), new PropertyMetadata(null));
HSButton.MyEnterBrushProperty = DependencyProperty.Register("MyEnterBrush", typeof(Brush), typeof(HSButton), new PropertyMetadata(null));
FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(HSButton), new FrameworkPropertyMetadata(typeof(HSButton)));
}
public HSButton()
{
base.Content = "";
base.Background = Brushes.Orange;
}
}
public class HSImageButton : Button
{
public static readonly DependencyProperty MyMoverBrushProperty;
public static readonly DependencyProperty MyEnterBrushProperty;
public Brush MyMoverBrush
{
get
{
return base.GetValue(HSImageButton.MyMoverBrushProperty) as Brush;
}
set
{
base.SetValue(HSImageButton.MyMoverBrushProperty, value);
}
}
public Brush MyEnterBrush
{
get
{
return base.GetValue(HSImageButton.MyEnterBrushProperty) as Brush;
}
set
{
base.SetValue(HSImageButton.MyEnterBrushProperty, value);
}
}
static HSImageButton()
{
HSImageButton.MyMoverBrushProperty = DependencyProperty.Register("MyMoverBrush", typeof(Brush), typeof(HSImageButton), new PropertyMetadata(null));
HSImageButton.MyEnterBrushProperty = DependencyProperty.Register("MyEnterBrush", typeof(Brush), typeof(HSImageButton), new PropertyMetadata(null));
FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(HSImageButton), new FrameworkPropertyMetadata(typeof(HSImageButton)));
}
public HSImageButton()
{
base.Content = "";
base.Background = Brushes.Orange;
}
}
}