日期:2014-05-18 浏览次数:20857 次
foreach (Control c in this.Controls) { //第一种情况:button在窗体上 Button btn = c as Button; if (btn != null) { if (btn.Text == "确定") { //do sth. } } //第二种情况:Button在panel等容器里面 Panel p = c as Panel; if (p != null) { foreach (Control cc in p.Controls) { Button c_btn = c as Button; if (c_btn != null) { if (c_btn.Text == "确定") { //do sth. } } } } }
------解决方案--------------------
是在同一个进程中不?同一个就是4L的方法,不再同一个进程的话,那就msdn SendMessage吧