schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using DataEntity.Share;
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using XCommon.Log;
using XHandler.View.Consumables;
using XHandler.View.MethodProperty;
 
namespace XHandler.View.ColorPicker
{
    /// <summary>
    /// 颜色拾取器窗体
    /// </summary>
    public partial class ColorPickerEx : Window
    {
        #region 变量
        /// <summary>
        /// 颜色
        /// </summary>
        public SolidColorBrush ColorBrush = null;
 
        #endregion
 
        #region 构造函数
        public ColorPickerEx()
        {
            InitializeComponent();
            this.Owner = (Window)Shared.Main;
        }
        #endregion
 
        #region 初始化
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ColorPicker.SelectedBrush = ColorBrush;
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
            }
        }
        #endregion
 
        #region 颜色拾取器 取消
        /// <summary>
        /// 颜色拾取器 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ColorPicker_Canceled(object sender, EventArgs e)
        {
            try
            {
                this.DialogResult = false;
                this.Close();
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
            }
        }
        #endregion
 
        #region 颜色拾取器 确定
        private void ColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<System.Windows.Media.Color> e)
        {
            try
            {
                ColorBrush = ColorPicker.SelectedBrush;
                this.DialogResult = true;
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
            }
        }
        #endregion
 
        #region ESC关闭画面
        /// <summary>
        /// ESC关闭画面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                this.Close();
            }
        }
        #endregion
 
    }
}