using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ryControls.TreeXML
{
public partial class frmAddTree : Form
{
private int m_IsAdd = 0;
///
/// 是否为添加
///
[Description("是否为添加")]
public int T_IsAdd
{
get { return m_IsAdd; }
set { m_IsAdd = value; }
}
private string m_SelectText = "";
///
/// 选择的文本
///
[Description("选择的文本")]
public string T_SelectText
{
get { return m_SelectText; }
set { m_SelectText = value; }
}
///
/// 选择的Tag
///
[Description("选择的Tag")]
public string T_SelectTag { get; set; } = "";
///
/// 选择的图片序号
///
[Description("选择的图片序号")]
public int T_ImageIndex { get; set; } = 0;
///
///
///
public frmAddTree()
{
InitializeComponent();
}
private void FrmAddTree_Load(object sender, EventArgs e)
{
comboBoxEx1.Items.Clear();
if (imageList1!=null)
{
for (int i =0; i < imageList1.Images.Count; i++)
{
comboBoxEx1.AddItem("", i.ToString(), imageList1.Images[i]);
}
comboBoxEx1.SelectedIndex = 0;
}
string sxText = "";
if (m_IsAdd == 0)
{ sxText = "编辑分组"; txtName.Text = m_SelectText; comboBoxEx1.SelectedIndex =T_ImageIndex; }
else { sxText = "添加分组"; };
Text = sxText;
}
private void BtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void BtnOK_Click(object sender, EventArgs e)
{
if (txtName.Text.Length<2)
{
MessageBox.Show("分组名称不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//if (txtKey.Text.Length < 2)
//{
// MessageBox.Show("分组关键字不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}
//if (txtKey.Text.IndexOf("[") >= 0 || txtKey.Text.IndexOf("]") >= 0)
//{
// MessageBox.Show("分组关键字不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}
m_SelectText = txtName.Text;
T_ImageIndex = comboBoxEx1.SelectedIndex;
this.DialogResult = DialogResult.OK;
}
}
}