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);
|
}
|
}
|
}
|
}
|