1.我这里有消息哦!!!——(窗体一)(可以是窗体也可以是用户控件)
public partial class SelectForm : Form
{
public ComboBox FiltercomBox
{
get { return this.comboFilter; }
}
public UltraTree SelectTree
{
get { return this.ultraTree1; }//baolou
}
public UltraTextEditor InputConditionText
{
get { return this.txtInputCondition; }
}
public UltraButton BtnOK
{
get { return this.btnOK; }//baolou
}
public UltraButton BtnSearch
{
get { return this.btnSearch; }
}
public SelectForm()
{
InitializeComponent();
}
public void IniitializeTree()
{
UltraTreeHelper.ForeachNodeWithProcess(SelectTree, node
=>
{
node.Override.NodeStyle = NodeStyle.CheckBox;
}
);
SelectTree.ExpandAll();
}
}
2.我需要你的信息,请给我,我需要使用!!!——(窗体二)
private void btnSelect_Click(object sender, EventArgs e)
{
form.BtnOK.Click += BtnOK_Click;
form.IniitializeTree();
form.StartPosition = FormStartPosition.Manual;
form.Location = new Point(480 + this.toolStrip1.Location.X + 40, 190 + this.toolStrip1.Location.Y + 20);
form.Show();
}
private void BtnOK_Click(object sender, EventArgs e)
{
UltraTreeHelper.ForeachNodeWithProcess(form.SelectTree, node
=>
{
if (node.CheckedState == CheckState.Checked)
{
sNode.SelectNodeList.Add(node.Text);
}
}
);
foreach (string str in sNode.SelectNodeList)
{
DataTable dt = this.ultraGrid2.DataSource as DataTable;
DataRow dr = dt.NewRow();
dr["学科"] = str;
dt.Rows.Add(dr);
}
form.Close();
}
3.接下来,现场演示喽……
窗体二点击选择展示窗体一
窗体一进行选择树节点的操作,想把选择的节点传给窗体二并显示
点击确定,消息成功传达窗体二,棒棒哒!