You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.1 KiB
96 lines
3.1 KiB
using System;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PaintingPC
|
|
{
|
|
public partial class FrmChangeColor : Form
|
|
{
|
|
public FrmChangeColor()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmChangeColor_Load(object sender, EventArgs e)
|
|
{
|
|
#region 加载颜色
|
|
|
|
int drow = 0, dcol = 4; //行,列
|
|
|
|
DataTable dt = Function.GetAllColor();
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
drow = Convert.ToInt32(Math.Ceiling((double)dt.Rows.Count / dcol));
|
|
RadioButton[] rbs = new RadioButton[dcol];
|
|
string[] dstr = new string[dt.Rows.Count];
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
//dstr[i] = dt.Rows[i]["Des"].ToString() + "," + dt.Rows[i]["ColorCode"].ToString() + "," + dt.Rows[i]["ColorNo"].ToString();
|
|
dstr[i] = dt.Rows[i]["Des"].ToString();
|
|
}
|
|
|
|
for (int i = 0; i < dcol; i++) //列
|
|
{
|
|
for (int j = 0; j < drow; j++) //行
|
|
{
|
|
rbs[i] = new RadioButton();
|
|
if ((i + dcol * j) < dstr.Length)
|
|
{
|
|
rbs[i].Text = dstr[i + dcol * j].ToString();
|
|
rbs[i].Font = new Font(rbs[i].Font.FontFamily, 20, FontStyle.Bold);
|
|
rbs[i].Size = new Size(300, 40);
|
|
rbs[i].Location = new Point(20 + i * (rbs[i].Size.Width + 15), 5 + j * (rbs[i].Size.Height + 10));
|
|
rbs[i].BackColor = Color.Transparent;
|
|
rbs[i].TextAlign = ContentAlignment.MiddleCenter;
|
|
panel2.Controls.Add(rbs[i]);
|
|
rbs[i].Click += new EventHandler(radioButton_Click);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
private void radioButton_Click(object sender, EventArgs e)
|
|
{
|
|
RadioButton rb = sender as RadioButton;
|
|
//rb.Select();
|
|
rb.Checked = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnBack_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 确定按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (Control c in panel2.Controls)
|
|
{
|
|
RadioButton rbn = c as RadioButton;
|
|
if (rbn.Checked)
|
|
{
|
|
//FrmFirstCheck.ColorName = rbn.Text;
|
|
//FrmSecondCheck.ColorName = rbn.Text;
|
|
FrmQuality.ColorName = rbn.Text;
|
|
}
|
|
}
|
|
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
}
|
|
|