/// <summary> /// 测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { string formName = this.FormName.Text; string buttonTxt = ButtonTxt.Text; // 调用FormControlManager ControlManager manager = new ControlManager(); string result = manager.BtnClickEvent(formName, buttonTxt); if (!string.IsNullOrEmpty(result)) { MessageBox.Show(result); } }
/// <summary> /// Form2取消按钮单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Cancle_Btn_Click(object sender, EventArgs e) { //if (MainWindows != IntPtr.Zero) //{ // IntPtr handle = Command.Findview(MainWindows, null, "取消"); // //单击 // Command.BtnLeftClick(handle); //} // 调用FormControlManager ControlManager manager = new ControlManager(); manager.BtnClickEvent("Form2", "取消", "groupBox1"); MainWindows = ConfigConst.MainFormHandle; }
void Run(object sender, System.Timers.ElapsedEventArgs e) { string formName = this.FormName.Text; string buttonTxt = ButtonTxt.Text; if (string.IsNullOrEmpty(formName) || string.IsNullOrEmpty(buttonTxt)) { MessageBox.Show("目标窗口或按钮名不能为空!"); return; } ControlManager manager = new ControlManager(); string result = manager.BtnClickEvent(formName, buttonTxt); if (!string.IsNullOrEmpty(result)) { MessageBox.Show(result); } }