LunarPresentation/ColorPicker/ColorPicker.xaml.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
namespace SHomeWorkshop.LunarPresentation
{
/// <summary>
/// Interaction logic for ColorPicker.xaml
/// </summary>
public partial class ColorPicker : UserControl
{
public ColorPicker()
{
InitializeComponent();
}
public enum Destination { Foreground, Background, Border, Other }
public Destination DestAction { get; set; }
private void Rectangle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Brush selectedColor = (sender as Rectangle).Fill;
OnColorPicked(sender,
new ColorPickedEventArgs() { PickedColor = selectedColor });
}
public event EventHandler<ColorPickedEventArgs> ColorPicked;
public event EventHandler<EventArgs> Closed;
protected void OnClosed(object sender, EventArgs e)
{
colorName.Text = "..右击色块复制名称..";
if (Closed != null)
{
Closed(this, e);
}
}
protected void OnColorPicked(object sender, ColorPickedEventArgs e)
{
if (ColorPicked != null)
{
ColorPicked(this, e);//注意,这里不用“sender”!!!
}
}
public static Brush GetBrushByName(string brushName)
{
Type type = typeof(Brushes);
PropertyInfo[] properties = type.GetProperties();
foreach (PropertyInfo pi in properties)
{
if (pi.Name == brushName)
{
后面还有 71 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。