/// <summary> /// 显示步骤对应的详情控件 /// </summary> public void DisplayXiangqing(object sender, EventArgs e) { foreach (UCchuli item in Setting.list_ucchuli) { item.lbl_buzhou.BackColor = Color.White; item.lbl_buzhou.ForeColor = Color.Black; } UCchuli myuc = ((Control)sender).Parent.Parent as UCchuli; myuc.lbl_buzhou.BackColor = Color.SteelBlue; myuc.lbl_buzhou.ForeColor = Color.White; panel_xiangqing.Controls.Clear(); panel_xiangqing.Controls.Add(myuc.control_xiangqing); //判断点击的步骤名称,改变group的组名 string str = myuc.lbl_buzhou.Text; if (str.Equals("正则替换")) { UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Text = "步骤详情"; ucchachong.groupBox5.Text = "处理前"; } else if (str.Equals("文本替换")) { UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Text = "步骤详情"; ucchachong.groupBox5.Text = "处理前"; } else if (str.Equals("添加前缀")) { UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Text = "前缀内容"; ucchachong.groupBox5.Text = "需要匹配的内容"; } else if (str.Equals("添加后缀")) { UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Text = "后缀内容"; ucchachong.groupBox5.Text = "需要匹配的内容"; } else if (str.Equals("清除换行符")) { UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Text = "步骤详情"; ucchachong.groupBox5.Text = "处理前"; } }
public UCchuli(string str, string selfname) { InitializeComponent(); lbl_buzhou.Text = str; myinfo._selfname = selfname; myinfo._updatedate = DateTime.Now.ToString("yyyy-MM-dd"); myinfo._name = str; //判断步骤类型,给text,_zhengze,_tihuan属性赋值 if (str.Equals("正则替换")) { myinfo._zhengze = "请输入正则表达式…"; myinfo._tihuan = "请输入…"; UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Name = "步骤详情"; ucchachong.groupBox5.Name = "处理前"; } else if (myinfo._name.Equals("文本替换")) { myinfo._zhengze = "请输入…"; myinfo._tihuan = "请输入…"; UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Name = "步骤详情"; ucchachong.groupBox5.Name = "处理前"; } else if (myinfo._name.Contains("添加前缀")) { myinfo._text = "请输入…"; UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Name = "前缀内容"; ucchachong.groupBox5.Name = "需要匹配的内容"; } else if (myinfo._name.Contains("添加后缀")) { myinfo._text = "请输入…"; UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Name = "后缀内容"; ucchachong.groupBox5.Name = "需要匹配的内容"; } else if (myinfo._name.Contains("清除换行符")) { myinfo._text = "清除换行符…"; UCNeirongchuli ucchachong = Setting._ucneirongchuli as UCNeirongchuli; ucchachong.groupBox2.Name = "步骤详情"; ucchachong.groupBox5.Name = "处理前"; } //构造步骤详情uc if (str.Contains("替换")) { control_xiangqing = new UCBuzhou(myinfo._zhengze, myinfo._tihuan) { Dock = DockStyle.Fill }; (control_xiangqing as UCBuzhou).tb_zhengze.TextChanged += Tb_zhengze_TextChanged; (control_xiangqing as UCBuzhou).tb_tihuan.TextChanged += Tb_tihuan_TextChanged; (control_xiangqing as UCBuzhou).tb_zhengze.Leave += UCchuli_Leave; (control_xiangqing as UCBuzhou).tb_tihuan.Leave += UCchuli_Leave; } else if (str.Contains("缀") || str.Contains("清除")) { control_xiangqing = new System.Windows.Forms.TextBox() { Dock = DockStyle.Fill, Text = myinfo._text, Multiline = true }; ((TextBox)control_xiangqing).TextChanged += UCchuli_TextChanged; ((TextBox)control_xiangqing).Leave += UCchuli_Leave; } }