工作中遇到这样一个需求,根据控件焦点弹出对应的代码帮助窗体。比如界面上,有两个TextBox需要进行代码帮助功能的实现。

  首先是绑定主窗体的代码帮助事件。Winform下有关控件焦点问题

首先要给代码帮助这个按钮绑定事件:

private void SailDateVoy_EventCodeHelp(object sender, EventArgs e)
        {
            #region 船东代码帮助
            if (ActiveControl.Name == "txbSLCARR")
            {
                SLCARRCodeHelp frm = new SLCARRCodeHelp();
                Penavicoxm.Common.MessageProcess.InfoShow(Penavicoxm.Common.ConstVariable.OpenPageWait);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    DataRow dr = frm.Row;
                    if (dr != null)
                    {
                        this.txbSLCARR.Text = dr["CARRCODE"].ToString().Trim();
                    }
                }
            }
            #endregion

            #region 航线代码帮助
            if (ActiveControl.Name == "txbSLLINE")
            {
                SLLINECodeHelp frm = new SLLINECodeHelp();
                Penavicoxm.Common.MessageProcess.InfoShow(Penavicoxm.Common.ConstVariable.OpenPageWait);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    DataRow dr = frm.Row;
                    if (dr != null)
                    {
                        this.txbSLLINE.Text = dr["ROUTECODE"].ToString().Trim();
                    }
                }
            }
            #endregion
        }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2021-05-20
  • 2022-02-08
  • 2021-08-03
  • 2021-08-08
相关资源
相似解决方案