领胜LDS 键盘AOI检测项目
wells.liu
2020-07-03 5f84b6324b78b0882e6c6f9c9eeae6c798922767
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
using System;
using System.Drawing;
using System.Windows.Forms;
 
namespace Bro.Common.UI
{
    public partial class GridCtrl : UserControl
    {
        public Action<bool> IsShowGridChanged { get; set; }
 
        public Action<int> GridValueChanged { get; set; }
 
        public Action<Color> GridColorChanged { get; set; }
 
        public GridCtrl()
        {
            InitializeComponent();
 
            IsChecked = chkShowGrid.Checked;
            GridValue = tbGridValue.Value;
        }
 
        bool isChecked = false;
        bool IsChecked
        {
            get => isChecked;
            set
            {
                if (isChecked != value)
                {
                    IsShowGridChanged?.BeginInvoke(value, null, null);
                }
 
                isChecked = value;
            }
        }
 
        int gridValue = 0;
        int GridValue
        {
            get => gridValue;
            set
            {
                if (gridValue != value)
                {
                    GridValueChanged?.BeginInvoke(value, null, null);
                }
 
                gridValue = value;
            }
        }
        private void chkShowGrid_CheckedChanged(object sender, EventArgs e)
        {
            IsChecked = chkShowGrid.Checked;
        }
 
        private void tbGridValue_ValueChanged(object sender, EventArgs e)
        {
            GridValue = tbGridValue.Value;
        }
 
        private void btnColor_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                btnColor.BackColor = colorDialog1.Color;
                GridColorChanged?.BeginInvoke(btnColor.BackColor, null, null);
            }
        }
    }
}