RaUI/Source/ryControls/TreeXML/frmAddTree.cs
2020-11-28 15:03:57 +08:00

97 lines
2.9 KiB
C#

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;
/// <summary>
/// 是否为添加
/// </summary>
[Description("是否为添加")]
public int T_IsAdd
{
get { return m_IsAdd; }
set { m_IsAdd = value; }
}
private string m_SelectText = "";
/// <summary>
/// 选择的文本
/// </summary>
[Description("选择的文本")]
public string T_SelectText
{
get { return m_SelectText; }
set { m_SelectText = value; }
}
/// <summary>
/// 选择的Tag
/// </summary>
[Description("选择的Tag")]
public string T_SelectTag { get; set; } = "";
/// <summary>
/// 选择的图片序号
/// </summary>
[Description("选择的图片序号")]
public int T_ImageIndex { get; set; } = 0;
/// <summary>
///
/// </summary>
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;
}
}
}